Skip to content

Commit

Permalink
Fix certificate retrieval bugs for players who had nonscoring games
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Jan 21, 2025
1 parent ef2cadb commit f6859f1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Gameboard.Api/Features/Certificates/CertificatesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ public async Task<IEnumerable<CompetitiveModeCertificate>> GetCompetitiveCertifi
.WithNoTracking<Data.Player>()
.Where
(
p => p.UserId == userId &&
p.SessionEnd > DateTimeOffset.MinValue &&
p.Game.PlayerMode == PlayerMode.Competition &&
(p.Game.GameEnd < now || p.Game.GameEnd == DateTimeOffset.MinValue) &&
p.Game.CertificateTemplateId != null
p =>
p.UserId == userId
&& (p.Game.GameEnd < now || p.Game.GameEnd == DateTimeOffset.MinValue)
// && p.Game.CertificateTemplateId != null
)
.WhereDateIsNotEmpty(p => p.SessionEnd)
.Where(p => p.Challenges.All(c => c.PlayerMode == PlayerMode.Competition))
Expand Down Expand Up @@ -159,7 +158,7 @@ public async Task<IEnumerable<CompetitiveModeCertificate>> GetCompetitiveCertifi
MaxPossibleScore = t.Game.MaxPossibleScore
},
Date = t.Game.GameEnd.IsEmpty() ? captain.SessionEnd : t.Game.GameEnd,
Rank = score.Rank > 0 ? score.Rank : null,
Rank = score?.Rank ?? 0,
Score = score is not null ? score.ScoreOverall : 0,
Duration = TimeSpan.FromMilliseconds(t.Time),
UniquePlayerCount = participationCounts?.UniquePlayerCount,
Expand Down

0 comments on commit f6859f1

Please sign in to comment.