diff --git a/LongevityWorldCup.Tests/LongevityWorldCup.Tests.csproj b/LongevityWorldCup.Tests/LongevityWorldCup.Tests.csproj
index 6b2135795..4541e7d93 100644
--- a/LongevityWorldCup.Tests/LongevityWorldCup.Tests.csproj
+++ b/LongevityWorldCup.Tests/LongevityWorldCup.Tests.csproj
@@ -9,8 +9,8 @@
-
-
+
+
all
diff --git a/LongevityWorldCup.Tests/SelectedAthleteBootstrapPageTests.cs b/LongevityWorldCup.Tests/SelectedAthleteBootstrapPageTests.cs
index b23c17f27..36b045a0e 100644
--- a/LongevityWorldCup.Tests/SelectedAthleteBootstrapPageTests.cs
+++ b/LongevityWorldCup.Tests/SelectedAthleteBootstrapPageTests.cs
@@ -20,14 +20,14 @@ public async Task SelectedAthleteRecovery_UsesSafeStorageCleanup(string path, st
if (path == "/dashboard")
{
var flow = await client.GetStringAsync("/js/play-athlete-flow.js");
- var recoveryStart = flow.IndexOf("function readRequiredSelectedAthlete()", StringComparison.Ordinal);
- var redirectIndex = flow.IndexOf("window.location.replace(\"/select-athlete\");", recoveryStart, StringComparison.Ordinal);
+ var recoveryStart = flow.IndexOf("function getStoredSelectedAthlete()", StringComparison.Ordinal);
+ var recoveryEnd = flow.IndexOf("function isValidSelectedAthlete(value)", recoveryStart, StringComparison.Ordinal);
- Assert.Contains("flow.readRequiredSelectedAthlete();", html);
+ Assert.Contains("flow.getStoredSelectedAthlete();", html);
Assert.True(recoveryStart >= 0);
- Assert.True(redirectIndex > recoveryStart);
+ Assert.True(recoveryEnd > recoveryStart);
- var recoveryBody = flow[recoveryStart..redirectIndex];
+ var recoveryBody = flow[recoveryStart..recoveryEnd];
Assert.Contains("function removeSessionItem(key)", flow);
Assert.Contains("removeSessionItem(\"selectedAthlete\");", recoveryBody);
@@ -87,7 +87,7 @@ public async Task SelectedAthleteValidation_RejectsArrays(string path)
if (path == "/dashboard")
{
- Assert.Contains("flow.readRequiredSelectedAthlete();", html);
+ Assert.Contains("flow.getStoredSelectedAthlete();", html);
}
else if (isBioagePage)
{
@@ -119,7 +119,7 @@ public async Task SelectedAthleteValidation_RejectsBlankNames(string path)
if (path == "/dashboard")
{
- Assert.Contains("flow.readRequiredSelectedAthlete();", html);
+ Assert.Contains("flow.getStoredSelectedAthlete();", html);
}
else if (isBioagePage)
{
diff --git a/LongevityWorldCup.Website/LongevityWorldCup.Website.csproj b/LongevityWorldCup.Website/LongevityWorldCup.Website.csproj
index 4a0b91ade..7e0a96f63 100644
--- a/LongevityWorldCup.Website/LongevityWorldCup.Website.csproj
+++ b/LongevityWorldCup.Website/LongevityWorldCup.Website.csproj
@@ -32,11 +32,11 @@
-
+
-
+
diff --git a/LongevityWorldCup.Website/wwwroot/js/play-athlete-flow.js b/LongevityWorldCup.Website/wwwroot/js/play-athlete-flow.js
index 7ead6cdd2..ffc8836e8 100644
--- a/LongevityWorldCup.Website/wwwroot/js/play-athlete-flow.js
+++ b/LongevityWorldCup.Website/wwwroot/js/play-athlete-flow.js
@@ -85,12 +85,15 @@ function getStoredSelectedAthlete() {
try {
const athlete = JSON.parse(json);
- return athlete && typeof athlete === "object" && typeof athlete.Name === "string"
- ? athlete
- : null;
+ if (isValidSelectedAthlete(athlete)) {
+ return athlete;
+ }
} catch (_) {
- return null;
}
+
+ removeSessionItem("selectedAthlete");
+ removeSessionItem("tempAthlete");
+ return null;
}
function isValidSelectedAthlete(value) {
diff --git a/LongevityWorldCup.Website/wwwroot/play/menu.html b/LongevityWorldCup.Website/wwwroot/play/menu.html
index 29954a758..765d90b5d 100644
--- a/LongevityWorldCup.Website/wwwroot/play/menu.html
+++ b/LongevityWorldCup.Website/wwwroot/play/menu.html
@@ -939,14 +939,25 @@ Athlete dashboardAthlete dashboardAthlete dashboard