Skip to content

Commit 29417ed

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 cf2478c commit 29417ed

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
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

0 commit comments

Comments
 (0)