Add example test suite
[gruntmaster-page.git] / lib / Gruntmaster / Page / Ct.pm
CommitLineData
fe78f0c1
MG
1package Gruntmaster::Page::Ct;
2
3use 5.014000;
4use strict;
5use warnings;
bb95f538
MG
6use Gruntmaster::Page::Base ct => 'Contests';
7our @ISA = qw/Gruntmaster::Page::Base/;
fe78f0c1
MG
8our $VERSION = '0.001';
9
bb95f538 10sub _generate{
191f4979
MG
11 my ($self, $htc, $lang, $env) = @_;
12 debug $env => "language is '$lang'";
fe78f0c1 13
cd9af27e 14 my (@running, @pending, @finished);
bfd8c0c4 15 for (sort {contest_start $a <=> contest_start $b}contests) {
cd9af27e
MG
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
331
This page took 0.016297 seconds and 4 git commands to generate.