]> iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/Log.pm
Fix previous commit
[gruntmaster-page.git] / lib / Gruntmaster / Page / Log.pm
1 package Gruntmaster::Page::Log;
2
3 use Gruntmaster::Page::Base log => 'Job log';
4
5 use constant PAGE_SIZE => 10;
6
7 sub _generate{
8 my ($self, $htc, $lang, $env, $ct, $page) = @_;
9 debug $env => "language is '$lang', contest is '$ct' and page is '$page'";
10 local $Gruntmaster::Data::contest = $ct if $ct;
11
12 my $pages = POSIX::floor (jobcard / PAGE_SIZE);
13 $pages ||= 1;
14 $page ||= $pages;
15
16 my @log = sort { $b->{id} <=> $a->{id} } map +{
17 id => $_,
18 (job_private() ? (private => job_private) : ()),
19 date => (job_date() ? strftime ('%c' => localtime job_date) : '?'),
20 extension => job_extension,
21 name => problem_name job_problem,
22 problem => job_problem,
23 result => job_result,
24 result_text => job_result_text,
25 size => sprintf ("%.2f KiB", job_filesize() / 1024),
26 user => job_user}, ($page - 1) * PAGE_SIZE + 1 .. ($page == $pages ? jobcard : $page * PAGE_SIZE);
27 $_->{user_name} = do { local $Gruntmaster::Data::contest; user_name $_->{user} } for @log;
28 $htc->param(log => \@log);
29 $htc->param(next => $page + 1) unless $page == $pages;
30 $htc->param(prev => $page - 1) unless $page == 1;
31 }
32
33 sub max_age { 5 }
34
35 1
This page took 0.067769 seconds and 4 git commands to generate.