]>
Commit | Line | Data |
---|---|---|
42546e6c MG |
1 | package Gruntmaster::Page::Pb; |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
bb95f538 MG |
6 | use Gruntmaster::Page::Base pb => 'Problems'; |
7 | our @ISA = qw/Gruntmaster::Page::Base/; | |
42546e6c MG |
8 | our $VERSION = '0.001'; |
9 | ||
bb95f538 | 10 | sub _generate{ |
191f4979 MG |
11 | my ($self, $htc, $lang, $env, $ct) = @_; |
12 | debug $env => "language is '$lang' and contest is '$ct'"; | |
7dc32473 | 13 | local $Gruntmaster::Data::contest = $ct if $ct; |
cd9af27e | 14 | |
cd9af27e MG |
15 | my @problems = sort { $b->{name} cmp $a->{name} } map +{ |
16 | id => $_, | |
17 | name => problem_name, | |
18 | level => problem_level}, problems; | |
bb95f538 | 19 | |
cd9af27e MG |
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); | |
42546e6c MG |
25 | } |
26 | ||
27 | 1 |