Add example test suite
[gruntmaster-page.git] / lib / Gruntmaster / Page / Ct.pm
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 (sort {contest_start $a <=> contest_start $b}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
This page took 0.021647 seconds and 4 git commands to generate.