Skip to content

Commit 8342cf2

Browse files
committed
Don't display clarification time from before 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.
1 parent 1f77c9a commit 8342cf2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

webapp/src/Twig/TwigExtension.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,16 @@ 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 = false): 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+
}
215218
$sign = ($relativeTime < 0 ? -1 : 1);
216219
$relativeTime *= $sign;
217220
// We're not showing seconds, while the last minute before

webapp/templates/team/partials/clarification_list.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<tr class="{% if team.unreadClarifications.contains(clarification) %}unseen{% endif %}">
2424
<td>
2525
<a data-ajax-modal data-ajax-modal-after="markSeen" href="{{ link }}">
26-
{{ clarification.submittime | printtime(null, clarification.contest) }}
26+
{{ clarification.submittime | printtime(null, clarification.contest, true) }}
2727
</a>
2828
</td>
2929
{%- if clarification.sender is null %}

0 commit comments

Comments
 (0)