Skip to content

Commit 2bde645

Browse files
nickygerritsenmeisterT
authored andcommitted
Do not update state when contest is paused.
1 parent 583d21d commit 2bde645

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

webapp/src/Service/EventLogService.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,14 @@ public function addMissingStateEvents(Contest $contest): void
470470

471471
// Because some states can happen in multiple different orders, we need to check per
472472
// field to see if we have a state event where that field matches the current value.
473+
// If the contest start is disabled, all fields should be null.
474+
// Note that for `started` the check already happens within the method, but we can better be explicit here.
473475
$states = [
474-
'started' => $contest->getStarttime(),
475-
'ended' => $contest->getEndtime(),
476-
'frozen' => $contest->getFreezetime(),
477-
'thawed' => $contest->getUnfreezetime(),
478-
'finalized' => $contest->getFinalizetime(),
476+
'started' => $contest->getStarttimeEnabled() ? $contest->getStarttime() : null,
477+
'ended' => $contest->getStarttimeEnabled() ? $contest->getEndtime() : null,
478+
'frozen' => $contest->getStarttimeEnabled() ? $contest->getFreezetime() : null,
479+
'thawed' => $contest->getStarttimeEnabled() ? $contest->getUnfreezetime() : null,
480+
'finalized' => $contest->getStarttimeEnabled() ? $contest->getFinalizetime() : null,
479481
];
480482

481483
// Because we have the events in order now, we can keep 'growing' the data to insert,

0 commit comments

Comments
 (0)