X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FSt.pm;h=b50490c00f3e31d6d22382c45b5003148373d6cc;hb=746789c0a194d8151e7e9dd830365e218206601f;hp=e3873ba51b418de037516ca24a52b7470f898757;hpb=2b0036ac8e077cc20cf9db6ff8dad4091ab50cb3;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/St.pm b/lib/Gruntmaster/Page/St.pm index e3873ba..b50490c 100644 --- a/lib/Gruntmaster/Page/St.pm +++ b/lib/Gruntmaster/Page/St.pm @@ -3,38 +3,35 @@ package Gruntmaster::Page::St; use 5.014000; use strict; use warnings; -use parent qw/Exporter/; -our @EXPORT_OK = qw/generate/; +use Gruntmaster::Page::Base st => 'Standings'; +our @ISA = qw/Gruntmaster::Page::Base/; our $VERSION = '0.001'; -use HTML::Template::Compiled; -use List::Util qw/sum/; -use POSIX qw/strftime/; -use Gruntmaster::Page::Common qw/cook_templates reload_templates/; -use Gruntmaster::Data qw/problems jobcard job_result_text job_result job_problem job_user/; - -my %orig_templates = ( +use constant TEMPLATES => { en => <<'HTML', -
UsernameTotal +
UsernameTotal +
UsernameScore + +
- - + +
HTML -); +}; -my %templates = cook_templates %orig_templates, st => 'Standings'; +sub _generate{ + my ($self, $htc, $path, $lang) = @_; -sub generate{ - %templates = cook_templates %orig_templates, st => 'Standings' if reload_templates; - local $Gruntmaster::Data::contest = ($_[0] =~ m,^ct/([^/]+)/,)[0]; - my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]}); + $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+)/) { @@ -52,9 +49,8 @@ sub generate{ scores => [map { $scores{$user}{$_} // '-'} @problems], } } keys %scores; - $htc->param(problems => \@problems); + $htc->param(problems => [map { problem_name } @problems ]) if $Gruntmaster::Data::contest; $htc->param(st => \@st); - $htc->output } 1