]> iEval git - gruntmaster-page.git/commitdiff
Don't split problems by levels in contests
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 23 Dec 2013 07:02:15 +0000 (09:02 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 23 Dec 2013 07:02:15 +0000 (09:02 +0200)
lib/Gruntmaster/Page/Pb.pm

index a3902c23676ed296a9e1173105bd7fec3a0d2780..0aae2b09d216b7d7470cb048eca41c570c6906f0 100644 (file)
@@ -18,6 +18,7 @@ use Gruntmaster::Page::Common qw/header footer/;
 
 my %templates = (
   en => <<'HTML',
+<tmpl_if levels>
 <h2>Beginner</h2>
 <ul>
 <tmpl_loop beginner><li><a href="<tmpl_var id>"><tmpl_var name></a>
@@ -37,6 +38,12 @@ my %templates = (
 <ul>
 <tmpl_loop hard><li><a href="<tmpl_var id>"><tmpl_var name></a>
 </tmpl_loop></ul>
+
+<tmpl_else>
+<ul>
+<tmpl_loop problems><li><a href="<tmpl_var id>"><tmpl_var name></a>
+</tmpl_loop></ul>
+</tmpl_if>
 HTML
 );
 
@@ -55,8 +62,10 @@ sub generate{
        my $id = (m,^$path/(.*)/meta.yml$,)[0];
        +{ 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->param($d => [grep {$_->{level} and $_->{level} eq $d} @problems]);
   }
+  $htc->param(levels => grep { $_->{level} } @problems);
+  $htc->param(problems => \@problems);
   $htc->output
 }
 
This page took 0.021697 seconds and 4 git commands to generate.