our @ISA = qw/Gruntmaster::Page::Base/;
our $VERSION = '0.001';
-use constant => TEMPLATES => {
+use constant TEMPLATES => {
en => <<'HTML',
<table border>
<thead>
-<tr><th>Username<tmpl_loop problems><th><tmpl_var _></tmpl_loop><th>Total
+<tmpl_if problems><tr><th>Username<tmpl_loop problems><th><tmpl_var _></tmpl_loop><th>Total
+<tmpl_else><tr><th>Username<th>Score
+</tmpl_if>
+
<tbody>
<tmpl_loop st><tr><td><tmpl_var user>
-<tmpl_loop scores><td><tmpl_var _>
-</tmpl_loop><td><tmpl_var score>
+<tmpl_if problems><tmpl_loop scores><td><tmpl_var _>
+</tmpl_loop></tmpl_if><td><tmpl_var score>
</tmpl_loop>
</table>
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+)/) {
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);
}