From 76bb9a2c5f8197aba908cbeee793bce0c82effbc Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 14 Feb 2015 14:03:26 -0800 Subject: [PATCH] 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. --- modules/cjeopardy/cjeopardy_scores.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/cjeopardy/cjeopardy_scores.pl b/modules/cjeopardy/cjeopardy_scores.pl index 48aa18cc..f5bb3531 100755 --- a/modules/cjeopardy/cjeopardy_scores.pl +++ b/modules/cjeopardy/cjeopardy_scores.pl @@ -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) {