]>
Commit | Line | Data |
---|---|---|
fe78f0c1 MG |
1 | package Gruntmaster::Page::Ct; |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
bb95f538 MG |
6 | use Gruntmaster::Page::Base ct => 'Contests'; |
7 | our @ISA = qw/Gruntmaster::Page::Base/; | |
fe78f0c1 MG |
8 | our $VERSION = '0.001'; |
9 | ||
bb95f538 | 10 | sub _generate{ |
191f4979 MG |
11 | my ($self, $htc, $lang, $env) = @_; |
12 | debug $env => "language is '$lang'"; | |
fe78f0c1 | 13 | |
cd9af27e MG |
14 | my (@running, @pending, @finished); |
15 | for (contests) { | |
16 | my $ct = { id => $_, | |
17 | name => contest_name, | |
18 | start => strftime ('%c', localtime contest_start), | |
19 | end => strftime ('%c', localtime contest_end), | |
20 | owner => contest_owner }; | |
fe78f0c1 | 21 | |
cd9af27e MG |
22 | my $time = time; |
23 | push @pending, $ct if time < contest_start; | |
24 | push @running, $ct if time >= contest_start && time < contest_end; | |
25 | push @finished, $ct if time > contest_end; | |
26 | } | |
fe78f0c1 | 27 | |
62a11450 MG |
28 | $htc->param(running => \@running) if @running; |
29 | $htc->param(pending => \@pending) if @pending; | |
30 | $htc->param(finished => \@finished) if @finished; | |
fe78f0c1 MG |
31 | } |
32 | ||
33 | 1 |