dynsub "push_$name", sub {
my $nr = INCR cp . $name;
HMSET cp . "$name.$nr", @_;
+ $nr
};
}
defhash problem => qw/name level statement/;
defhash contest => qw/start end name owner/;
-defhash job => qw/date file name private problem result result_text user/;
+defhash job => qw/date extension filesize private problem result result_text user/;
our @EXPORT_OK = do {
no strict 'refs';
declaregen 'Ct::Entry' => qr,^ct/$component/index$,;
declaregen St => qr,^ct/$component/log/st$,;
declaregen Log => qr,^${contest}log/(?:\d+|index)$,;
- declaregen 'Log::Entry' => qr,^${contest}log/$component/index$,;
+ declaregen 'Log::Entry' => qr,^${contest}log/job/$component$,;
declaregen Submit => qr,^${contest}submit$,;
declaregen Pb => qr,^${contest}pb/index$,;
declaregen 'Pb::Entry' => qr,^${contest}pb/$component$,;
use HTML::Template::Compiled;
use POSIX qw/strftime/;
use Gruntmaster::Page::Common qw/header footer/;
-use Gruntmaster::Data qw/job_date job_file problem_name job_private job_problem job_result job_result_text job_user/;
+use Gruntmaster::Data qw/jobcard job_date job_extension job_filesize problem_name job_private job_problem job_result job_result_text job_user/;
my %templates = (
en => <<'HTML',
<thead>
<tr><th>ID<th>Problem<th>Date<th>Size<th>User<th>Result
<tbody>
-<tmpl_loop log><tr><td><a href="<tmpl_var id>"><tmpl_var id></a>
+<tmpl_loop log><tr><td><a href="job/<tmpl_var id>.var"><tmpl_var id></a>
<td><a href="../pb/<tmpl_var problem>"><tmpl_var name></a>
<td><tmpl_var date>
-<td><a href="src/<tmpl_var filename>"<tmpl_if private> data-private</tmpl_if>><tmpl_var size></a></a>
+<td><a href="src/<tmpl_var id>.<tmpl_var extension>"<tmpl_if private> data-private</tmpl_if>><tmpl_var size></a></a>
<td><tmpl_var user><td class="r<tmpl_var result>"><tmpl_var result_text>
</tmpl_loop>
</table>
sub generate{
$_[0] =~ m,^(?:ct/([^/]+)/)?log/(\w+)\.html$,;
local $Gruntmaster::Data::contest = $1;
- my $page = $2 eq 'index' ? 0 : $2;
+ my $pages = jobcard / PAGE_SIZE;
+ my $page = $2 eq 'index' ? $pages : $2;
my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});
my @log = sort { $b->{id} <=> $a->{id} } map +{
id => $_,
(job_private() ? (private => job_private) : ()),
date => (job_date() ? strftime ('%c' => localtime job_date) : '?'),
+ extension => job_extension,
name => problem_name job_problem,
problem => job_problem,
result => job_result,
result_text => job_result_text,
- size => sprintf ("%.2f KiB", (length job_file) / 1024),
- user => job_user}, ($page - 1) * PAGE_SIZE + 1 .. $page * PAGE_SIZE;
+ size => sprintf ("%.2f KiB", job_filesize() / 1024),
+ user => job_user}, ($page - 1) * PAGE_SIZE + 1 .. $page == $pages ? jobcard : $page * PAGE_SIZE;
$htc->param(log => \@log);
$htc->output
}