Skip to content

Commit

Permalink
[B] Fix standings not showing countryCode if driver did not participa…
Browse files Browse the repository at this point in the history
…te in latest race
  • Loading branch information
SSchulze1989 committed Jan 15, 2025
1 parent 2b9b96a commit cd8a230
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public override Task<StandingCalculationResult> 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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private async Task<IEnumerable<EventCalculationResult>> GetPreviousResultsAsync(
{
LeagueId = eventResult.LeagueId,
EventId = eventResult.EventId,
Date = eventResult.Event.Date,
Name = eventResult.Name,
ResultConfigId = eventResult.ResultConfigId,
ResultId = eventResult.ResultId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AddPenaltyCalculationData> AddPenalties { get; set; } = Array.Empty<AddPenaltyCalculationData>();
public IEnumerable<SessionCalculationData> SessionResults { get; set; } = Array.Empty<SessionCalculationData>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit cd8a230

Please sign in to comment.