Add votes-final flag, warn on missing votes, and sync phases with results toggle

This commit is contained in:
2026-02-04 22:54:36 +01:00
parent 91692856f9
commit 13c8bb6194
13 changed files with 318 additions and 6 deletions

View File

@@ -23,13 +23,26 @@ internal static class EndpointHelpers
var player = await db.Players.FirstOrDefaultAsync(p => p.Id == playerId);
if (player is null) return Phase.Suggest;
var state = await db.AppState.FirstAsync();
// Auto-upgrade any legacy Reveal phase to Vote to avoid blank screens
if (player.CurrentPhase == Phase.Reveal)
{
player.CurrentPhase = Phase.Vote;
await db.SaveChangesAsync();
}
// Keep phases aligned with results availability
if (state.ResultsOpen && player.CurrentPhase != Phase.Results)
{
player.CurrentPhase = Phase.Results;
}
else if (!state.ResultsOpen && player.CurrentPhase == Phase.Results)
{
player.CurrentPhase = Phase.Vote;
player.VotesFinal = false;
}
await db.SaveChangesAsync();
return player.CurrentPhase;
}