From 8458b9573fd6fd364528c45641fe2395f2f54bf0 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Wed, 15 Jan 2025 07:31:40 +0100 Subject: [PATCH 1/2] [B] Fix standings not showing countryCode if driver did not participate in latest race --- .../Calculation/MemberStandingCalculationService.cs | 4 +++- .../ResultService/DataAccess/EventCalculationDataProvider.cs | 2 ++ .../DataAccess/StandingCalculationDataProvider.cs | 1 + .../ResultService/Models/EventCalculationData.cs | 1 + .../ResultService/Models/EventCalculationResult.cs | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/iRLeagueApiCore.Services/ResultService/Calculation/MemberStandingCalculationService.cs b/src/iRLeagueApiCore.Services/ResultService/Calculation/MemberStandingCalculationService.cs index 3011e4df..ab0b4ae5 100644 --- a/src/iRLeagueApiCore.Services/ResultService/Calculation/MemberStandingCalculationService.cs +++ b/src/iRLeagueApiCore.Services/ResultService/Calculation/MemberStandingCalculationService.cs @@ -74,7 +74,9 @@ public override Task Calculate(StandingCalculationDat .OrderBy(GetDropweekOverrideOrderValue); var currentResult = currentMemberResult.GetValueOrDefault(memberId); var standingRow = new StandingRowCalculationResult(); - var lastResult = currentResult ?? previousEventResults.FirstOrDefault(); + var lastResult = currentResult ?? previousEventResults + .OrderBy(x => x.EventResult.Date) + .LastOrDefault(); var lastRow = lastResult?.SessionResults.LastOrDefault()?.ResultRow; if (lastRow is null) { diff --git a/src/iRLeagueApiCore.Services/ResultService/DataAccess/EventCalculationDataProvider.cs b/src/iRLeagueApiCore.Services/ResultService/DataAccess/EventCalculationDataProvider.cs index 28537d3a..791f96c9 100644 --- a/src/iRLeagueApiCore.Services/ResultService/DataAccess/EventCalculationDataProvider.cs +++ b/src/iRLeagueApiCore.Services/ResultService/DataAccess/EventCalculationDataProvider.cs @@ -156,6 +156,7 @@ private static bool LapIsValid(TimeSpan lap) { LeagueId = eventResult.LeagueId, EventId = eventResult.EventId, + Date = eventResult.Event.Date, SessionResults = eventResult.SessionResults .OrderBy(sessionResult => sessionResult.Session.SessionNr) .Select(sessionResult => new SessionCalculationData() @@ -229,6 +230,7 @@ private static bool LapIsValid(TimeSpan lap) { LeagueId = eventResult.LeagueId, EventId = eventResult.EventId, + Date = eventResult.Event.Date, SessionResults = eventResult.ScoredSessionResults .OrderBy(sessionResult => sessionResult.SessionNr) .Select(sessionResult => new SessionCalculationData() diff --git a/src/iRLeagueApiCore.Services/ResultService/DataAccess/StandingCalculationDataProvider.cs b/src/iRLeagueApiCore.Services/ResultService/DataAccess/StandingCalculationDataProvider.cs index 55164f5a..bdbe1b98 100644 --- a/src/iRLeagueApiCore.Services/ResultService/DataAccess/StandingCalculationDataProvider.cs +++ b/src/iRLeagueApiCore.Services/ResultService/DataAccess/StandingCalculationDataProvider.cs @@ -90,6 +90,7 @@ private async Task> GetPreviousResultsAsync( { LeagueId = eventResult.LeagueId, EventId = eventResult.EventId, + Date = eventResult.Event.Date, Name = eventResult.Name, ResultConfigId = eventResult.ResultConfigId, ResultId = eventResult.ResultId, diff --git a/src/iRLeagueApiCore.Services/ResultService/Models/EventCalculationData.cs b/src/iRLeagueApiCore.Services/ResultService/Models/EventCalculationData.cs index fe85018b..f62131ab 100644 --- a/src/iRLeagueApiCore.Services/ResultService/Models/EventCalculationData.cs +++ b/src/iRLeagueApiCore.Services/ResultService/Models/EventCalculationData.cs @@ -4,6 +4,7 @@ internal sealed class EventCalculationData { public long LeagueId { get; set; } public long EventId { get; set; } + public DateTime? Date { get; set; } public IEnumerable AddPenalties { get; set; } = Array.Empty(); public IEnumerable SessionResults { get; set; } = Array.Empty(); } diff --git a/src/iRLeagueApiCore.Services/ResultService/Models/EventCalculationResult.cs b/src/iRLeagueApiCore.Services/ResultService/Models/EventCalculationResult.cs index d5f4e5fe..eb81debb 100644 --- a/src/iRLeagueApiCore.Services/ResultService/Models/EventCalculationResult.cs +++ b/src/iRLeagueApiCore.Services/ResultService/Models/EventCalculationResult.cs @@ -8,10 +8,12 @@ public EventCalculationResult(EventCalculationData data) { LeagueId = data.LeagueId; EventId = data.EventId; + Date = data.Date; } public long LeagueId { get; set; } public long EventId { get; set; } + public DateTime? Date { get; set; } public long? ResultId { get; set; } public long? ChampSeasonId { get; set; } public long? ResultConfigId { get; set; } From d3cd429fbb720b11f11f856d4430b2b007068a01 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Wed, 15 Jan 2025 07:32:32 +0100 Subject: [PATCH 2/2] bump version to 0.14.7 --- src/iRLeagueApiCore.Client/iRLeagueApiCore.Client.csproj | 2 +- src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj | 2 +- src/iRLeagueApiCore.Server/iRLeagueApiCore.Server.csproj | 2 +- src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/iRLeagueApiCore.Client/iRLeagueApiCore.Client.csproj b/src/iRLeagueApiCore.Client/iRLeagueApiCore.Client.csproj index fb04c894..41ab0439 100644 --- a/src/iRLeagueApiCore.Client/iRLeagueApiCore.Client.csproj +++ b/src/iRLeagueApiCore.Client/iRLeagueApiCore.Client.csproj @@ -13,7 +13,7 @@ Library net8.0 iRLeagueApiCore.Client - 0.14.6 + 0.14.7 Simon Schulze Simon Schulze This package contains shared objects for all members of the iRLeagueDatabase-iRLeagueApi stack diff --git a/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj b/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj index ce1a59fc..31a4f303 100644 --- a/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj +++ b/src/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj @@ -18,7 +18,7 @@ Library net8.0 iRLeagueApiCore.Common - 0.14.6 + 0.14.7 Simon Schulze Simon Schulze enable diff --git a/src/iRLeagueApiCore.Server/iRLeagueApiCore.Server.csproj b/src/iRLeagueApiCore.Server/iRLeagueApiCore.Server.csproj index 0f38ae24..aadd4549 100644 --- a/src/iRLeagueApiCore.Server/iRLeagueApiCore.Server.csproj +++ b/src/iRLeagueApiCore.Server/iRLeagueApiCore.Server.csproj @@ -78,7 +78,7 @@ true - 0.14.6 + 0.14.7 enable diff --git a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj index 8e40a3d7..375f8a7a 100644 --- a/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj +++ b/src/iRLeagueDatabaseCore/iRLeagueDatabaseCore.csproj @@ -35,7 +35,7 @@ net8.0 12 iRLeagueDatabaseCore - 0.14.6 + 0.14.7 enable