]> iEval git - gruntmaster-page.git/blobdiff - lib/Plack/App/Gruntmaster/HTML.pm
Fix editorials for contests with less than 4 problems
[gruntmaster-page.git] / lib / Plack / App / Gruntmaster / HTML.pm
index bdd20c2d183439a6ef7635abc3bf38b075282e82..eb3c56765964e4d1ec09fb70d14b7865c64b3738 100644 (file)
@@ -195,6 +195,7 @@ sub process_pb {
                $div->find('tbody')->find('tr')->iter3($args{$data}, $titer);
        };
        $tree->fid('beginner')->iter3([grep {$args{$_}} qw/beginner easy medium hard/], $iter);
+       $tree->fid('open-alert')->detach unless $args{contest};
 }
 
 sub process_log_entry {
@@ -249,7 +250,7 @@ sub process_log {
                next unless $elem;
                delete $args{args}{page};
                my $str = join '&', map { $_ . '=' . $args{args}{$_} } keys %{$args{args}};
-               $elem->find('a')->edit_href(sub{s/$/&$str/});
+               $elem->find('a')->edit_href(sub{s/$/&$str/}) if $str;
        }
        $tree->fclass('current')->replace_content("Page $args{current_page} of $args{last_page}");
 }
@@ -283,6 +284,6 @@ sub process_ed {
                $div->set_child_content(class => 'solution', literal $data->{solution});
                $div->fclass('problem')->namedlink($data->{id}, $data->{name});
        };
-       my @pb = map { @{$args{$_}} } qw/beginner easy medium hard/;
+       my @pb = map { @{$args{$_} // []} } qw/beginner easy medium hard/;
        $tree->fclass('well')->iter3(\@pb, $iter);
 }
This page took 0.027209 seconds and 4 git commands to generate.