Fix voting start time race condition
Set votingStartAt to 1 minute in the past when opening/reopening rounds or awards. This ensures voting is immediately available without the "opens in less than a minute" message appearing due to timing differences between when the date is set and when the page renders. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -268,7 +268,9 @@ export const roundRouter = router({
|
||||
|
||||
if (input.status === 'ACTIVE' && previousRound.status !== 'ACTIVE') {
|
||||
if (previousRound.votingStartAt && previousRound.votingStartAt > now) {
|
||||
updateData.votingStartAt = now
|
||||
// Set to 1 minute in the past to ensure voting is immediately open
|
||||
const oneMinuteAgo = new Date(now.getTime() - 60 * 1000)
|
||||
updateData.votingStartAt = oneMinuteAgo
|
||||
votingStartAtUpdated = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user