Closed eargollo closed 10 months ago
Add some tests and refactor https://github.com/eargollo/soccer/blob/main/app/models/standing.rb#L4
Add scope for finished and make the win and losses computation at the matches model. Something around the lines:
finished
wins = team.home_matches.won_by_home.count + team.away_matches.won_by_away.count losses = team.home_matches.won_by_away.count + team.away_matches.won_by_home.count draw = team.home_matches.count + team.away_matches.draw.count
Put business logic into the Model.
Solved by #2
Add some tests and refactor https://github.com/eargollo/soccer/blob/main/app/models/standing.rb#L4
Add scope for
finished
and make the win and losses computation at the matches model. Something around the lines:Put business logic into the Model.