Rewrite query to be easier to understand

This commit is contained in:
smoogipoo 2021-10-10 15:43:24 +09:00
parent f199d6c521
commit c49d0a5013
1 changed files with 3 additions and 4 deletions

View File

@ -74,10 +74,9 @@ public async Task<ScoreInfo[]> OrderByTotalScoreAsync(ScoreInfo[] scores, Cancel
var totalScores = await Task.WhenAll(scores.Select(s => GetTotalScoreAsync(s, cancellationToken: cancellationToken))).ConfigureAwait(false);
return scores.Select((s, i) => (index: i, score: s))
.OrderByDescending(key => totalScores[key.index])
.ThenBy(key => key.score.OnlineScoreID)
.Select(key => key.score)
return scores.Select((score, index) => (score: score, totalScore: totalScores[index]))
.OrderByDescending(g => g.totalScore)
.Select(g => g.score)
.ToArray();
}