Skip to content

Commit

Permalink
Defense solution for team session start denormalization
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Jan 11, 2025
1 parent 5ac505b commit 5e6f709
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ await _validatorService
})
.ToArrayAsync(cancellationToken);

var begin = teamSession.Select(p => p.SessionBegin).Distinct().Single();
var end = teamSession.Select(p => p.SessionEnd).Distinct().Single();
// max is a kludge here - there should only be one, but
// becaues of denormalized structure, bugs could cause more than one
var begin = teamSession.Select(p => p.SessionBegin).Max();
var end = teamSession.Select(p => p.SessionEnd).Max();

if (begin.IsEmpty())
return GamePlayState.NotStarted;
Expand Down

0 comments on commit 5e6f709

Please sign in to comment.