Skip to content

Arina1004/player_statistics

Repository files navigation

Сonsole application

Installation

Install Bundler, если нет. Установить нужные гемы:

gem install bundler
bundle install

To apply migration

bundle exec rake db:migrate

Fill the database with test data:

bundle exec rake db:seed

How use

Run rails console:

bundle exec rails console

To assign a player metric:

MatchMetric::CreateMatchMetric.new.call(params: {player: Player.find(1), metric: Metric.find(1), match: Match.find(1)})

To update the metric:

MatchMetric::UpdateMatchMetric.new.call(match_metric: MatchMetric.find(1), params: {player: Player.find(1), metric: Metric.find(1), match: Match.find(1)})

To check whether a player has completed a metric for the previous 5 matches:

 Player.check_match_metric(metric: Metric.find(1))

To find the top 5 players for a specific metric among all players:

Player::TopFivePlayers.new.call(params: { metric: Metric.find(1)})

or among the team:

Player::TopFivePlayers.new.call(params: { metric: Metric.find(1), team: Team.find(1)})

Tests

To run:

 rspec

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published