feat(lobby): canonical backend round flow for issue #287 #298

Merged
integrator-bot merged 8 commits from issue-287-canonical-round-flow-backend into main 2026-03-16 07:25:52 +01:00
Showing only changes of commit 624bcd602b - Show all commits

View File

@@ -247,6 +247,16 @@ def _maybe_promote_reveal_to_scoreboard(session: GameSession) -> GameSession:
if current_round_question is None:
return session
players_count = Player.objects.filter(session=session).count()
guess_count = Guess.objects.filter(round_question=current_round_question).count()
has_score_events = ScoreEvent.objects.filter(
session=session,
meta__round_question_id=current_round_question.id,
).exists()
reveal_is_resolved = has_score_events or (players_count > 0 and guess_count >= players_count)
if not reveal_is_resolved:
return session
with transaction.atomic():
locked_session = GameSession.objects.select_for_update().get(pk=session.pk)
if locked_session.status != GameSession.Status.REVEAL: