X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FLog.pm;h=cdef1df1aa9f4fbb167bd40d6ebc10b6760e7f8a;hb=eafc7f54b9d964aac41b0715e18caf5ed58ef89a;hp=fce36cbe8fe1a4f5d91b3082c528a9cb18060bcb;hpb=bb95f538bf263c0294d87cfb90d58c66117b9aab;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Log.pm b/lib/Gruntmaster/Page/Log.pm index fce36cb..cdef1df 100644 --- a/lib/Gruntmaster/Page/Log.pm +++ b/lib/Gruntmaster/Page/Log.pm @@ -9,10 +9,6 @@ our $VERSION = '0.001'; use constant PAGE_SIZE => 10; -use constant FORMAT_EXTENSION => { - CPP => 'cpp', -}; - use constant TEMPLATES => { en => <<'HTML', @@ -33,8 +29,8 @@ sub _generate{ my ($self, $htc, $path, $lang) = @_; $path =~ m,^(?:ct/([^/]+)/)?log/(\w+)\.html$,; - local $Gruntmaster::Data::contest = $1; - my $pages = jobcard / PAGE_SIZE; + local $Gruntmaster::Data::contest = $1 if $1; + my $pages = POSIX::ceil (jobcard / PAGE_SIZE); my $page = $2 eq 'index' ? $pages : $2; my @log = sort { $b->{id} <=> $a->{id} } map +{ @@ -47,7 +43,7 @@ sub _generate{ result => job_result, result_text => job_result_text, size => sprintf ("%.2f KiB", job_filesize() / 1024), - user => job_user}, ($page - 1) * PAGE_SIZE + 1 .. $page == $pages ? jobcard : $page * PAGE_SIZE; + user => job_user}, ($page - 1) * PAGE_SIZE + 1 .. ($page == $pages ? jobcard : $page * PAGE_SIZE); $htc->param(log => \@log); }