From: Marius Gavrilescu Date: Mon, 27 Jan 2014 13:38:37 +0000 (+0200) Subject: Fix and update standings X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=410a7b480cdfac00c2dc65b9313ea79ecafac2b5;p=plack-app-gruntmaster.git Fix and update standings --- diff --git a/gruntmaster-genallpages b/gruntmaster-genallpages index 7588f02..ea15578 100755 --- a/gruntmaster-genallpages +++ b/gruntmaster-genallpages @@ -13,7 +13,6 @@ sub generate{ generate "ct/index.html"; generate "ct/$_/index.thml" for contests; -generate "ct/$_/log/st.html" for contests; generate "us/index.html"; generate "us/$_.html" for users; @@ -21,6 +20,7 @@ generate "us/$_.html" for users; for my $ct (undef, contests) { local $Gruntmaster::Data::contests = $ct; my $ctp = defined $ct ? "ct/$ct/" : ''; + generate "${ctp}log/st.html"; generate "${ctp}log/index.html"; my $pagecnt = jobcard / Gruntmaster::Page::Log::PAGE_SIZE; generate "${ctp}log/$_.html" for 1 .. $pagecnt; diff --git a/lib/Gruntmaster/Page.pm b/lib/Gruntmaster/Page.pm index 451ed8e..71f5173 100644 --- a/lib/Gruntmaster/Page.pm +++ b/lib/Gruntmaster/Page.pm @@ -38,7 +38,7 @@ sub declaregen{ declaregen 'Us::Entry' => qr,^us/$component$,; declaregen Ct => qr,^ct/index$,; declaregen 'Ct::Entry' => qr,^ct/$component/index$,; - declaregen St => qr,^ct/$component/log/st$,; + declaregen St => qr,^${contest}log/st$,; declaregen Log => qr,^${contest}log/(?:\d+|index)$,; declaregen 'Log::Entry' => qr,^${contest}log/job/$component$,; declaregen Submit => qr,^${contest}submit$,; diff --git a/lib/Gruntmaster/Page/St.pm b/lib/Gruntmaster/Page/St.pm index dafd5df..b91137e 100644 --- a/lib/Gruntmaster/Page/St.pm +++ b/lib/Gruntmaster/Page/St.pm @@ -7,7 +7,7 @@ use Gruntmaster::Page::Base st => 'Standings'; our @ISA = qw/Gruntmaster::Page::Base/; our $VERSION = '0.001'; -use constant => TEMPLATES => { +use constant TEMPLATES => { en => <<'HTML', @@ -24,9 +24,11 @@ HTML sub _generate{ my ($self, $htc, $path, $lang) = @_; - local $Gruntmaster::Data::contest = ($path =~ m,^ct/([^/]+)/,)[0]; + $path =~ m,^(?:ct/([^/]+)/)?,; + local $Gruntmaster::Data::contest = $1; - my @problems = sort problems; + my @problems = problems; + @problems = sort @problems; my %scores; for (1 .. jobcard) { if (job_result_text =~ m/^(\d+)/) { @@ -44,7 +46,7 @@ sub _generate{ scores => [map { $scores{$user}{$_} // '-'} @problems], } } keys %scores; - $htc->param(problems => \@problems); + $htc->param(problems => [map { problem_name } @problems ]); $htc->param(st => \@st); }