]> iEval git - gruntmaster-page.git/blame - lib/Gruntmaster/Page/Log/Entry.pm
Add user list and user pages
[gruntmaster-page.git] / lib / Gruntmaster / Page / Log / Entry.pm
CommitLineData
42546e6c
MG
1package Gruntmaster::Page::Log::Entry;
2
3use 5.014000;
4use strict;
5use warnings;
6use parent qw/Exporter/;
7our @EXPORT_OK = qw/generate/;
8our $VERSION = '0.001';
9
42546e6c 10use HTML::Template::Compiled;
42546e6c 11use POSIX qw/strftime/;
2b0036ac 12use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
cd9af27e 13use Gruntmaster::Data qw/job_results/;
42546e6c 14
2b0036ac 15my %orig_templates = (
cd9af27e 16 en => <<'HTML',
42546e6c
MG
17<table border>
18<thead>
19<tr><th>Test number<th>Result<th>Time
20<tbody>
21<tmpl_loop tests><tr><td><tmpl_var id><td class="r<tmpl_var result>"><tmpl_var result_text><td><tmpl_var time>
22</tmpl_loop>
23</table>
24HTML
25);
26
2b0036ac 27my %templates = cook_templates %orig_templates, log_entry => 'Job <tmpl_var id>';
42546e6c
MG
28
29sub generate{
2b0036ac 30 %templates = cook_templates %orig_templates, log_entry => 'Job <tmpl_var id>' if reload_templates;
e5f2bda6 31 $_[0] =~ m,^(?:ct/([^/]+)/)?log/job/([^/]+)\.html$,;
cd9af27e
MG
32 local $Gruntmaster::Data::contest = $1;
33 my $id = $2;
34
35 my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});
36
37 my @tests = map {
38 $_->{time} = sprintf "%.4fs", $_->{time};
39 $_
40 } @{job_results $id};
41
42 $htc->param(id => $id);
43 $htc->param(tests => \@tests);
44 $htc->output
42546e6c
MG
45}
46
471
This page took 0.02368 seconds and 4 git commands to generate.