diff --git a/Server/src/SOR.Admin/Components/Pages/Game/CustomLobbiesPage.razor b/Server/src/SOR.Admin/Components/Pages/Game/CustomLobbiesPage.razor index 2181885..d85a42a 100644 --- a/Server/src/SOR.Admin/Components/Pages/Game/CustomLobbiesPage.razor +++ b/Server/src/SOR.Admin/Components/Pages/Game/CustomLobbiesPage.razor @@ -44,8 +44,8 @@ else
-
@_lobbies.Count(l => l.Status == CustomLobbyStatus.Cancelled)
-
Cancelled Today
+
@_lobbies.Count(l => l.Status == CustomLobbyStatus.Cancelled || l.Status == CustomLobbyStatus.Completed)
+
Ended Today
@@ -59,6 +59,7 @@ else + @@ -149,6 +150,7 @@ else .AsNoTracking() .Where(l => l.Status == CustomLobbyStatus.Open || l.Status == CustomLobbyStatus.Full + || l.Status == CustomLobbyStatus.Started || l.CreatedAt >= cutoff) .OrderByDescending(l => l.CreatedAt) .Take(200) @@ -178,6 +180,7 @@ else CustomLobbyStatus.Full => "bg-warning text-dark", CustomLobbyStatus.Started => "bg-success", CustomLobbyStatus.Cancelled => "bg-secondary", + CustomLobbyStatus.Completed => "bg-dark", _ => "bg-secondary", }; } diff --git a/Server/src/SOR.Database/Enums/GameEnums.cs b/Server/src/SOR.Database/Enums/GameEnums.cs index 329890d..3679294 100644 --- a/Server/src/SOR.Database/Enums/GameEnums.cs +++ b/Server/src/SOR.Database/Enums/GameEnums.cs @@ -60,4 +60,6 @@ public enum CustomLobbyStatus Started, /// Lobby was cancelled by the host before a game started. Cancelled, + /// The game session created from this lobby has ended. + Completed, } diff --git a/Server/src/SOR.Game/Handlers/GameHandlerBase.cs b/Server/src/SOR.Game/Handlers/GameHandlerBase.cs index c523dba..b399d9e 100644 --- a/Server/src/SOR.Game/Handlers/GameHandlerBase.cs +++ b/Server/src/SOR.Game/Handlers/GameHandlerBase.cs @@ -161,6 +161,13 @@ internal abstract class GameHandlerBase session.WinCondition = winCondition; session.EndedAt = DateTimeOffset.UtcNow; + // Mark the linked custom lobby as Completed so it disappears from the active-games + // browser. Ranked sessions have no linked lobby; the query safely returns null. + var linkedLobby = await gameDb.CustomLobbies + .FirstOrDefaultAsync(l => l.GameSessionId == session.Id, ct); + if (linkedLobby != null && linkedLobby.Status == CustomLobbyStatus.Started) + linkedLobby.Status = CustomLobbyStatus.Completed; + // Save game session status FIRST — this must succeed before we touch ELO. // If identity DB fails below, the session is still correctly marked Completed // so players won't be stuck in a ghost match on next login.