]>
Commit | Line | Data |
---|---|---|
1 | package Gruntmaster::Page::Pb; | |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | use Gruntmaster::Page::Base pb => 'Problems'; | |
7 | our @ISA = qw/Gruntmaster::Page::Base/; | |
8 | our $VERSION = '0.001'; | |
9 | ||
10 | sub _generate{ | |
11 | my ($self, $htc, $lang, $env, $ct) = @_; | |
12 | debug $env => "language is '$lang' and contest is '$ct'"; | |
13 | local $Gruntmaster::Data::contest = $ct if $ct; | |
14 | ||
15 | my @problems = sort { $b->{name} cmp $a->{name} } map +{ | |
16 | id => $_, | |
17 | name => problem_name, | |
18 | level => problem_level}, problems; | |
19 | ||
20 | for my $d (qw/beginner easy medium advanced hard/) { | |
21 | $htc->param($d => [grep {$_->{level} and $_->{level} eq $d} @problems]); | |
22 | } | |
23 | $htc->param(levels => grep { $_->{level} } @problems); | |
24 | $htc->param(problems => \@problems); | |
25 | } | |
26 | ||
27 | 1 |