From ebca729db7cdee3b542db9cb9f2508f701941c10 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 25 Jan 2015 13:34:23 +0200 Subject: [PATCH] Sort problems in standings by value and fix standings JSON --- lib/Plack/App/Gruntmaster.pm | 5 ++++- lib/Plack/App/Gruntmaster/HTML.pm | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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 { -- 2.39.2