Skip to content

Commit f4933d9

Browse files
committed
Fix bug is stats calc.
1 parent 46f49e2 commit f4933d9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

MyApp.ServiceInterface/LeaderboardServices.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ public async Task<object> Any(CalculateLeaderBoard request)
4141
private CalculateLeaderboardResponse CalculateLeaderboardResponse(List<StatTotals> statTotals, List<StatTotals> statsByUser, List<StatTotals> answers)
4242
{
4343
var statQuestions = statTotals.Where(x => !x.Id.Contains('-')).ToList();
44+
45+
// There might not be answers to some questions which we want to exclude from the win rate
46+
statQuestions = statQuestions.Where(x => answers.Any(y => y.PostId == x.PostId)).ToList();
4447

4548
var overallWinRates = statsByUser.GroupBy(x => x.Id).Select(y =>
4649
{
50+
// sum all the wins for this user
4751
var res = new LeaderBoardWinRate
4852
{
4953
Id = y.Key,

0 commit comments

Comments
 (0)