diff --git a/src/server/routers/round.ts b/src/server/routers/round.ts index 06ad903..99668f6 100644 --- a/src/server/routers/round.ts +++ b/src/server/routers/round.ts @@ -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 } } diff --git a/src/server/routers/specialAward.ts b/src/server/routers/specialAward.ts index c2d7665..6628b07 100644 --- a/src/server/routers/specialAward.ts +++ b/src/server/routers/specialAward.ts @@ -207,9 +207,11 @@ export const specialAwardRouter = router({ } if (input.status === 'VOTING_OPEN' && current.status !== 'VOTING_OPEN') { - // If no voting start date, or if it's in the future, set it to now + // If no voting start date, or if it's in the future, set it to 1 minute ago + // to ensure voting is immediately open (avoids race condition with page render) if (!current.votingStartAt || current.votingStartAt > now) { - updateData.votingStartAt = now + const oneMinuteAgo = new Date(now.getTime() - 60 * 1000) + updateData.votingStartAt = oneMinuteAgo votingStartAtUpdated = true } }