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}.");

View File

@@ -99,7 +99,6 @@ public static class StateEndpoints
private static Phase NextPhase(Phase current) => current switch
{
Phase.Suggest => Phase.Vote,
Phase.Reveal => Phase.Vote, // legacy safety
Phase.Vote => Phase.Results,
_ => Phase.Results
};
@@ -108,7 +107,6 @@ public static class StateEndpoints
{
Phase.Results => Phase.Vote,
Phase.Vote => Phase.Suggest,
Phase.Reveal => Phase.Suggest, // legacy safety
_ => Phase.Suggest
};
}