Require suggestion before entering vote phase

This commit is contained in:
2026-02-07 13:18:55 +01:00
parent c3951b95ac
commit 9d3947714a
13 changed files with 77 additions and 18 deletions

View File

@@ -61,6 +61,17 @@ public static class StateEndpoints
var reconciled = EndpointHelpers.ReconcilePlayerPhase(player, appState.ResultsOpen);
var next = NextPhase(player.CurrentPhase);
if (next == Phase.Vote)
{
var hasSuggestions = await db.Suggestions.AnyAsync(s => s.PlayerId == player.Id);
if (!hasSuggestions)
{
if (reconciled)
await db.SaveChangesAsync();
return EndpointHelpers.BadRequestError("Add at least one suggestion before entering the Vote phase.");
}
}
if (next == Phase.Results && !appState.ResultsOpen)
{
if (reconciled)
@@ -108,4 +119,3 @@ public static class StateEndpoints
_ => Phase.Suggest
};
}