From: Marius Gavrilescu Date: Sun, 22 Dec 2013 23:05:34 +0000 (+0200) Subject: Split problem list into levels X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=9be91908e37325aae1af68d98f8aafce310c6950;p=plack-app-gruntmaster.git Split problem list into levels --- diff --git a/lib/Gruntmaster/Page/Pb.pm b/lib/Gruntmaster/Page/Pb.pm index 617112a..a2cccff 100644 --- a/lib/Gruntmaster/Page/Pb.pm +++ b/lib/Gruntmaster/Page/Pb.pm @@ -18,8 +18,29 @@ use Gruntmaster::Page::Common qw/header footer/; my %templates = ( en => <<'HTML', +

Beginner

+ +

Easy

+ + +

Medium

+ + +

Advanced

+ + +

Hard

+ HTML ); @@ -37,8 +58,10 @@ sub generate{ my @problems = sort { $b->{name} cmp $a->{name} } map { my $meta = LoadFile $_; my $id = (m,^$path/(.*)/meta.yml$,)[0]; - +{ id => $id, name => $meta->{name} } } <$path/*/meta.yml>; - $htc->param(problems => \@problems); + +{ id => $id, name => $meta->{name}, level => $meta->{level} } } <$path/*/meta.yml>; + for my $d(qw/beginner easy medium advanced hard/) { + $htc->param($d => [grep {$_->{level} eq $d} @problems]); + } $htc->output }