Skip to content

Commit 71c0111

Browse files
committed
Don't display clarification time from before/after contest
It looks ugly in some cases and less professional in others where printing happened much earlier. The exact time is not relevant and could lead to discussions with teams. Originally this was only for the team interface but it does add information for the jury. It's more important to know that something happened before the contest (or after) and the interpretation of that time as knowing when it exactly happened.
1 parent dd8c2b7 commit 71c0111

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

webapp/src/Twig/TwigExtension.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,20 @@ public function printelapsedminutes(float $start, float $end): string
205205
* Print a time formatted as specified. The format is according to date().
206206
* @param Contest|null $contest If given, print time relative to that contest start.
207207
*/
208-
public function printtime(string|float|null $datetime, ?string $format = null, ?Contest $contest = null): string
208+
public function printtime(string|float|null $datetime, ?string $format = null, ?Contest $contest = null, bool $squash = true): string
209209
{
210210
if ($datetime === null) {
211211
$datetime = Utils::now();
212212
}
213213
if ($contest !== null && $this->config->get('show_relative_time')) {
214214
$relativeTime = $contest->getContestTime((float)$datetime);
215+
if ($relativeTime < 0 && $squash) {
216+
return "Before contest";
217+
}
218+
if ($relativeTime > $contest->getContestTime($contest->getEndtime())) {
219+
// The case where it would be exactly at EndTime is important to display
220+
return "After contest";
221+
}
215222
$sign = ($relativeTime < 0 ? -1 : 1);
216223
$relativeTime *= $sign;
217224
// We're not showing seconds, while the last minute before

webapp/templates/partials/problem_list.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
data-bs-toggle="tooltip"
106106
data-bs-placement="top"
107107
data-bs-html="true"
108-
title="Between {{ stat.start.timestamp | printtime(null, contest) }} and {{ stat.end.timestamp | printtime(null, contest) }}:<br/>{{ label }}">
108+
title="Between {{ stat.start.timestamp | printtime(null, contest, false) }} and {{ stat.end.timestamp | printtime(null, contest, false) }}:<br/>{{ label }}">
109109
</div>
110110
{% endfor %}
111111
</div>

0 commit comments

Comments
 (0)