Group players with identical stats under the same rank

If Bill and Bob both have 10 correct answers, place them both
under the same rank of #5 instead of putting Bill at #5 and
Bob at #6.
This commit is contained in:
Pragmatic Software 2015-02-14 14:03:26 -08:00
parent 559b9ddde1
commit 76bb9a2c5f
1 changed files with 6 additions and 1 deletions

View File

@ -178,10 +178,15 @@ if (lc $command eq 'rank') {
my $rank = 0;
my $stats;
my $last_value = -1;
foreach my $player (@$players) {
next if $player->{nick} eq 'keep2play';
$stats = $ranks{$key}->{print}->($player);
$rank++ if defined $stats;
if (defined $stats) {
my ($value) = $stats =~ /[^:]+:\s+(.*)/;
$rank++ if $value ne $last_value;
$last_value = $value;
}
last if lc $player->{nick} eq $opt;
}
if ($rank == 0) {