Stop phase polling writes unless state changes

This commit is contained in:
2026-02-05 17:04:52 +01:00
parent 8e50b31a5b
commit 52960a78bc
2 changed files with 6 additions and 2 deletions

View File

@@ -39,24 +39,28 @@ internal static class EndpointHelpers
var state = await db.AppState.FirstAsync();
var changed = false;
// Auto-upgrade any legacy Reveal phase to Vote to avoid blank screens
if (player.CurrentPhase == Phase.Reveal)
{
player.CurrentPhase = Phase.Vote;
changed = true;
}
// Keep phases aligned with results availability
if (state.ResultsOpen && player.CurrentPhase != Phase.Results)
{
player.CurrentPhase = Phase.Results;
changed = true;
}
else if (!state.ResultsOpen && player.CurrentPhase == Phase.Results)
{
player.CurrentPhase = Phase.Vote;
player.VotesFinal = false;
changed = true;
}
var changed = db.ChangeTracker.HasChanges();
if (changed)
{
await db.SaveChangesAsync();