Ajoute l Elo et les statistiques de parties

This commit is contained in:
2026-04-16 00:17:52 +02:00
parent db233e7110
commit 407e5e8ed5
13 changed files with 1914 additions and 11 deletions

View File

@@ -4,6 +4,7 @@
@inject MatchStore Store
@inject NavigationManager Navigation
@inject SocialRealtimeService Realtime
@inject MatchStatsService MatchStats
<PageTitle>ChessCubing Arena | Phase Chrono</PageTitle>
<PageBody Page="chrono" BodyClass="@ChronoBodyClass" />
@@ -198,6 +199,8 @@ else if (Match is not null && summary is not null && blackZone is not null && wh
return;
}
await EnsureResultReportedAsync();
_tickerCancellation = new CancellationTokenSource();
_ = RunTickerAsync(_tickerCancellation.Token);
StateHasChanged();
@@ -221,6 +224,7 @@ else if (Match is not null && summary is not null && blackZone is not null && wh
private async Task HandleRealtimeChangedAsync()
{
await ApplyCollaborativeSyncAsync();
await EnsureResultReportedAsync();
StateHasChanged();
}
@@ -419,6 +423,7 @@ else if (Match is not null && summary is not null && blackZone is not null && wh
private async Task PersistAndRouteAsync()
{
await EnsureResultReportedAsync();
Store.MarkDirty();
await Store.SaveAsync();
@@ -437,6 +442,20 @@ else if (Match is not null && summary is not null && blackZone is not null && wh
StateHasChanged();
}
private async Task EnsureResultReportedAsync()
{
var match = Match;
if (match is null || string.IsNullOrWhiteSpace(match.Result) || match.ResultRecordedUtc is not null)
{
return;
}
if (await MatchStats.TryReportCompletedMatchAsync(match))
{
Store.MarkDirty();
}
}
private ChronoSummaryView BuildSummary()
{
var match = Match!;