Require suggestion before entering vote phase
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user