Remove legacy reveal phase paths and rename reveal data loader

This commit is contained in:
2026-02-07 01:49:38 +01:00
parent 5e84686678
commit 567502d665
7 changed files with 24 additions and 29 deletions

View File

@@ -51,7 +51,7 @@ internal static class EndpointHelpers
public static Phase GetCurrentPhase(Phase phase, bool resultsOpen)
{
var normalized = phase == Phase.Reveal ? Phase.Vote : phase;
var normalized = NormalizePhase(phase);
if (resultsOpen)
return Phase.Results;
@@ -63,9 +63,10 @@ internal static class EndpointHelpers
{
var changed = false;
if (player.CurrentPhase == Phase.Reveal)
var normalized = NormalizePhase(player.CurrentPhase);
if (player.CurrentPhase != normalized)
{
player.CurrentPhase = Phase.Vote;
player.CurrentPhase = normalized;
changed = true;
}
@@ -84,6 +85,17 @@ internal static class EndpointHelpers
return changed;
}
private static Phase NormalizePhase(Phase phase)
{
return phase switch
{
Phase.Suggest => Phase.Suggest,
Phase.Vote => Phase.Vote,
Phase.Results => Phase.Results,
_ => Phase.Vote // legacy/invalid phase fallback
};
}
public static IResult PhaseMismatch(Phase required, Phase current) =>
BadRequestError($"This endpoint is available in the {required} phase. Your current phase is {current}.");