]>
iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/St.pm
1 package Gruntmaster
::Page
::St
;
6 use parent qw
/Exporter/;
7 our @EXPORT_OK = qw
/generate/;
8 our $VERSION = '0.001';
10 use constant TITLE
=> 'Standings';
12 use HTML
::Template
::Compiled
;
13 use List
::Util qw
/sum/;
14 use POSIX qw
/strftime/;
15 use Gruntmaster
::Page
::Common qw
/header footer/;
16 use Gruntmaster
::Data qw
/problems jobcard job_result_text job_result job_problem job_user/;
22 <tr><th>Username<tmpl_loop problems><th><tmpl_var _></tmpl_loop><th>Total
24 <tmpl_loop st><tr><td><tmpl_var user>
25 <tmpl_loop scores><td><tmpl_var _>
26 </tmpl_loop><td><tmpl_var score>
32 $templates{$_} = header
($_, TITLE
) . $templates{$_} for keys %templates;
33 $templates{$_} .= footer
$_ for keys %templates;
36 local $Gruntmaster::Data
::contest
= ($_[0] =~ m
,^ct
/([^/]+)/,)[0];
37 my $htc = HTML
::Template
::Compiled
->new(scalarref
=> \
$templates{$_[1]});
39 my @problems = sort problems
;
42 if (job_result_text
=~ m/^(\d+)/) {
43 $scores{job_user
()}{job_problem
()} = $1;
45 $scores{job_user
()}{job_problem
()} = job_result
() ?
0 : 100;
49 my @st = sort { $b->{score
} <=> $a->{score
} } map {
53 score
=> sum
(values $scores{$user}),
54 scores
=> [map { $scores{$user}{$_} // '-'} @problems],
57 $htc->param(problems
=> \
@problems);
58 $htc->param(st
=> \
@st);
This page took 0.045861 seconds and 4 git commands to generate.