statement => literal $args{statement},
author => $args{author},
owner => $args{owner_name} || $args{owner});
+ if ($args{contest_stop}) {
+ my $countdown = $tree->fid('countdown');
+ $countdown->attr('data-start' => $args{contest_start});
+ $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}));
+ } else {
+ $_->detach for $tree->fclass('rc'); # requires contest
+ }
if ($args{cansubmit}) {
$tree->look_down(name => 'problem')->attr(value => $args{id});
my $contest = $tree->look_down(name => 'contest');
<dl>
<dt>Author</dt> <dd id="author">author</dd>
<dt>Owner</dt> <dd id="owner">owner</dd>
+<dt class="rc">Score</dt> <dd id="score" data-value="100" class="rc">50</dd>
+<dt class="rc">Contest ends in</dt> <dd id="countdown" data-start="..." data-time="..." data-stop="..." class="rc">01:30</dd>
</dl>
<a href="/pb/problem_id/log/" id="job_log">Job log</a>