From: Marius Gavrilescu Date: Sun, 25 Jan 2015 11:34:23 +0000 (+0200) Subject: Sort problems in standings by value and fix standings JSON X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=ebca729db7cdee3b542db9cb9f2508f701941c10;p=gruntmaster-page.git Sort problems in standings by value and fix standings JSON --- diff --git a/lib/Plack/App/Gruntmaster.pm b/lib/Plack/App/Gruntmaster.pm index 991159b..efcedf5 100644 --- a/lib/Plack/App/Gruntmaster.pm +++ b/lib/Plack/App/Gruntmaster.pm @@ -144,7 +144,10 @@ sub dispatch_request{ sub (/st/:contest) { response st => 'Standings', { st => [ contest->standings ], - problems => [map { $_->problem } contest->contest_problems], + problems => [ + map { [$_->id, $_->name] } + sort { $a->value <=> $b->value } + map { $_->problem } contest->contest_problems], }, 10 }, diff --git a/lib/Plack/App/Gruntmaster/HTML.pm b/lib/Plack/App/Gruntmaster/HTML.pm index 91699e6..e84f600 100644 --- a/lib/Plack/App/Gruntmaster/HTML.pm +++ b/lib/Plack/App/Gruntmaster/HTML.pm @@ -243,7 +243,7 @@ sub process_st { my $pbiter = sub { my ($data, $th) = @_; $th->attr(class => undef); - $th->namedlink($data->id, $data->name); + $th->namedlink(@$data); }; $tree->fclass('problem')->iter3($args{problems}, $pbiter); my $iter = sub {