]>
Commit | Line | Data |
---|---|---|
1 | package Gruntmaster::Page::Ct; | |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | use Gruntmaster::Page::Base ct => 'Contests'; | |
7 | our @ISA = qw/Gruntmaster::Page::Base/; | |
8 | our $VERSION = '0.001'; | |
9 | ||
10 | sub _generate{ | |
11 | my ($self, $htc, $lang, $env) = @_; | |
12 | debug $env => "language is '$lang'"; | |
13 | ||
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 }; | |
21 | ||
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 | } | |
27 | ||
28 | $htc->param(running => \@running) if @running; | |
29 | $htc->param(pending => \@pending) if @pending; | |
30 | $htc->param(finished => \@finished) if @finished; | |
31 | } | |
32 | ||
33 | 1 |