Skip to content

Commit

Permalink
Fix bug is stats calc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Apr 3, 2024
1 parent 46f49e2 commit f4933d9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions MyApp.ServiceInterface/LeaderboardServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ public async Task<object> Any(CalculateLeaderBoard request)
private CalculateLeaderboardResponse CalculateLeaderboardResponse(List<StatTotals> statTotals, List<StatTotals> statsByUser, List<StatTotals> answers)
{
var statQuestions = statTotals.Where(x => !x.Id.Contains('-')).ToList();

// There might not be answers to some questions which we want to exclude from the win rate
statQuestions = statQuestions.Where(x => answers.Any(y => y.PostId == x.PostId)).ToList();

var overallWinRates = statsByUser.GroupBy(x => x.Id).Select(y =>
{
// sum all the wins for this user
var res = new LeaderBoardWinRate
{
Id = y.Key,
Expand Down

0 comments on commit f4933d9

Please sign in to comment.