Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion webapp/src/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,16 @@ public function printelapsedminutes(float $start, float $end): string
* Print a time formatted as specified. The format is according to date().
* @param Contest|null $contest If given, print time relative to that contest start.
*/
public function printtime(string|float|null $datetime, ?string $format = null, ?Contest $contest = null): string
public function printtime(string|float|null $datetime, ?string $format = null, ?Contest $contest = null, bool $squash = false): string
{
if ($datetime === null) {
$datetime = Utils::now();
}
if ($contest !== null && $this->config->get('show_relative_time')) {
$relativeTime = $contest->getContestTime((float)$datetime);
if ($relativeTime < 0 && $squash) {
return "Before contest";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if this makes sense in general and not just here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just display it in the table, I didn't find other locations yet (also didn't really search) but in general I agree. Probably best to move this commit out and do this in a separate PR to find the other locations.

}
$sign = ($relativeTime < 0 ? -1 : 1);
$relativeTime *= $sign;
// We're not showing seconds, while the last minute before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<tr class="{% if team.unreadClarifications.contains(clarification) %}unseen{% endif %}">
<td>
<a data-ajax-modal data-ajax-modal-after="markSeen" href="{{ link }}">
{{ clarification.submittime | printtime(null, clarification.contest) }}
{{ clarification.submittime | printtime(null, clarification.contest, true) }}
</a>
</td>
{%- if clarification.sender is null %}
Expand Down