1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 13:02:54 +08:00

Merge pull request #21338 from RATCM/fix-leaderboard-filter

Match leaderboard filter behaviour to web
This commit is contained in:
Dean Herbert 2022-11-21 14:01:55 +09:00 committed by GitHub
commit 4a79141824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,10 +204,11 @@ namespace osu.Game.Screens.Select.Leaderboards
} }
else if (filterMods) else if (filterMods)
{ {
// otherwise find all the scores that have *any* of the currently selected mods (similar to how web applies mod filters) // otherwise find all the scores that have all of the currently selected mods (similar to how web applies mod filters)
// we're creating and using a string list representation of selected mods so that it can be translated into the DB query itself // we're creating and using a string HashSet representation of selected mods so that it can be translated into the DB query itself
var selectedMods = mods.Value.Select(m => m.Acronym); var selectedMods = mods.Value.Select(m => m.Acronym).ToHashSet();
scores = scores.Where(s => s.Mods.Any(m => selectedMods.Contains(m.Acronym)));
scores = scores.Where(s => selectedMods.SetEquals(s.Mods.Select(m => m.Acronym)));
} }
scores = scoreManager.OrderByTotalScore(scores.Detach()); scores = scoreManager.OrderByTotalScore(scores.Detach());