From: Marius Gavrilescu Date: Thu, 12 Feb 2015 17:56:38 +0000 (+0200) Subject: Sort on problem.value not problem.level in contest standings X-Git-Tag: 5999.000_014~74 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=ce3b056aa661013f458ec2c1e52456776cf17648;p=gruntmaster-data.git Sort on problem.value not problem.level in contest standings --- diff --git a/lib/Gruntmaster/Data/Result/Contest.pm b/lib/Gruntmaster/Data/Result/Contest.pm index 02a50ca..2a57c95 100644 --- a/lib/Gruntmaster/Data/Result/Contest.pm +++ b/lib/Gruntmaster/Data/Result/Contest.pm @@ -210,7 +210,7 @@ sub standings { my ($self) = @_; my $ct = $self->id; - my @problems = map { $_->rawproblem } $self->contest_problems->search({contest => $ct}, {qw/join problem order_by problem.level/}); + my @problems = map { $_->rawproblem } $self->contest_problems->search({contest => $ct}, {qw/join problem order_by problem.value/}); my (%scores, %tries, %opens); $opens{$_->rawproblem, $_->rawowner} = $_ for $self->opens->search({contest => $ct}); for my $job ($self->jobs->search({contest => $ct, result => {'!=', undef}}, {qw/order_by me.id prefetch/ => [qw/problem/]})) { @@ -225,6 +225,7 @@ sub standings { my %user_to_name = map { $_->id => $_->name } $self->result_source->schema->users->all; + say STDERR join "\n\n", @problems; my @st = sort { $b->{score} <=> $a->{score} or $a->{user} cmp $b->{user} } map { ## no critic (ProhibitReverseSortBlock) my $user = $_; +{