Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: elpassion/elranks
base: 32a8aabc9f
...
head fork: elpassion/elranks
compare: 36a8131816
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 4 additions and 4 deletions.
  1. +4 −4 app/models/player.rb
View
8 app/models/player.rb
@@ -17,18 +17,18 @@ def setup_default_rating
end
def count_matches(tournament)
- matches.confirmed.where(tournament_id: tournament.id).count
+ matches.confirmed.where(tournament_id: tournament.id).count('distinct match_id')
end
def count_wins(tournament)
- matches.confirmed.where('tournament_id = ? and winners @> ARRAY[?]', tournament.id, self.id).count
+ matches.confirmed.where('tournament_id = ? and winners @> ARRAY[?]', tournament.id, self.id).count('distinct match_id')
end
def count_losts(tournament)
- matches.confirmed.where('tournament_id = ? and (array_length(winners, 1) > 0 and not (winners @> ARRAY[?]))', tournament.id, self.id).count
+ matches.confirmed.where('tournament_id = ? and (coalesce(array_length(winners, 1), 0) > 0 and not (winners @> ARRAY[?]))', tournament.id, self.id).count('distinct match_id')
end
def count_draws(tournament)
- matches.confirmed.where('tournament_id = ? and array_length(winners, 1) = 0', tournament.id).count
+ matches.confirmed.where('tournament_id = ? and coalesce(array_length(winners, 1), 0) = 0', tournament.id).count('distinct match_id')
end
end

No commit comments for this range

Something went wrong with that request. Please try again.