]> iEval git - plack-app-gruntmaster.git/blobdiff - lib/Plack/App/Gruntmaster/HTML.pm
Sort problems in standings by value and fix standings JSON
[plack-app-gruntmaster.git] / lib / Plack / App / Gruntmaster / HTML.pm
index 5505a3917973f1f7991b4f691433018b68a521aa..e84f6003d70a54f7972a24dfc61911a23e185d20 100644 (file)
@@ -138,22 +138,25 @@ sub process_pb_entry {
        $tree->fid('owner')->edit_href(sub{s/owner_id/$args{owner}/});
        $tree->fid('job_log')->edit_href(sub{s/problem_id/$args{id}/});
        $tree->fid('solution')->edit_href(sub{s/problem_id/$args{id}/});
+       $tree->fid('job_log')->edit_href(sub{$_ .= "&private=$args{private}"}) if $args{private};
        $tree->content_handler(
                statement => literal $args{statement},
+               level     => ucfirst $args{level},
                author    =>         $args{author},
                owner     =>         $args{owner_name} || $args{owner});
        if ($args{contest_stop}) {
                $tree->fid('solution')->detach;
                $tree->fid('solution_modal')->detach;
                my $countdown = $tree->fid('countdown');
-               $countdown->attr('data-start' => $args{contest_start});
+               $countdown->attr('data-start' => $args{open_time});
                $countdown->attr('data-stop' => $args{contest_stop});
                $countdown->attr('data-time' => $args{time});
                my $left = $args{contest_stop} - $args{time};
                $countdown->replace_content(sprintf '%02d:%02d:%02d', $left/60/60, $left/60%60, $left%60);
                $tree->fid('score')->attr('data-value' => $args{value});
-               $tree->fid('score')->replace_content(Gruntmaster::Data::calc_score($args{value}, $args{time} - $args{contest_start}, 0, $args{contest_stop} - $args{contest_start}));
+               $tree->fid('score')->replace_content(Gruntmaster::Data::Result::Contest::calc_score($args{value}, $args{time} - $args{open_time}, 0, $args{contest_stop} - $args{contest_start}));
        } else {
+               $tree->fid('solution')->detach unless $args{solution};
                $_->detach for $tree->fclass('rc'); # requires contest
                $tree->fid('solution_modal')->fclass('modal-body')->replace_content(literal $args{solution});
        }
@@ -211,6 +214,7 @@ sub process_log_entry {
                $tr->fclass('result_text')->attr(class => "r$data->{result}")
        };
        $args{results} ? $tree->fid('results')->find('tbody')->find('tr')->iter3($args{results}, $iter) : $tree->fid('results')->detach;
+       $tree->fid('no_results')->detach if $tree->fid('results') || $tree->fid('errors');
 }
 
 sub process_log {
@@ -239,7 +243,7 @@ sub process_st {
        my $pbiter = sub {
                my ($data, $th) = @_;
                $th->attr(class => undef);
-               $th->namedlink($data->id, $data->name);
+               $th->namedlink(@$data);
        };
        $tree->fclass('problem')->iter3($args{problems}, $pbiter);
        my $iter = sub {
This page took 0.019245 seconds and 4 git commands to generate.