From 9be91908e37325aae1af68d98f8aafce310c6950 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Mon, 23 Dec 2013 01:05:34 +0200 Subject: [PATCH] Split problem list into levels --- lib/Gruntmaster/Page/Pb.pm | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) 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 } -- 2.39.2