]>
Commit | Line | Data |
---|---|---|
42546e6c MG |
1 | package Gruntmaster::Page::Log; |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
bb95f538 MG |
6 | use Gruntmaster::Page::Base log => 'Job log'; |
7 | our @ISA = qw/Gruntmaster::Page::Base/; | |
42546e6c MG |
8 | our $VERSION = '0.001'; |
9 | ||
cd9af27e | 10 | use constant PAGE_SIZE => 10; |
42546e6c | 11 | |
bb95f538 | 12 | sub _generate{ |
191f4979 MG |
13 | my ($self, $htc, $lang, $env, $ct, $page) = @_; |
14 | debug $env => "language is '$lang', contest is '$ct' and page is '$page'"; | |
7dc32473 | 15 | local $Gruntmaster::Data::contest = $ct if $ct; |
42546e6c | 16 | |
b83e43dc | 17 | my $pages = POSIX::floor (jobcard / PAGE_SIZE); |
b9d003fd | 18 | $pages ||= 1; |
a94f8453 | 19 | $page ||= $pages; |
cd9af27e | 20 | |
cd9af27e MG |
21 | my @log = sort { $b->{id} <=> $a->{id} } map +{ |
22 | id => $_, | |
23 | (job_private() ? (private => job_private) : ()), | |
24 | date => (job_date() ? strftime ('%c' => localtime job_date) : '?'), | |
e5f2bda6 | 25 | extension => job_extension, |
3da9c3c2 | 26 | name => problem_name job_problem, |
cd9af27e MG |
27 | problem => job_problem, |
28 | result => job_result, | |
29 | result_text => job_result_text, | |
e5f2bda6 | 30 | size => sprintf ("%.2f KiB", job_filesize() / 1024), |
493d07a5 | 31 | user => job_user}, ($page - 1) * PAGE_SIZE + 1 .. ($page == $pages ? jobcard : $page * PAGE_SIZE); |
cd9af27e | 32 | $htc->param(log => \@log); |
b83e43dc MG |
33 | $htc->param(next => $page + 1) unless $page == $pages; |
34 | $htc->param(prev => $page - 1) unless $page == 1; | |
42546e6c MG |
35 | } |
36 | ||
ff57a758 MG |
37 | sub max_age { 5 } |
38 | ||
42546e6c | 39 | 1 |