1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 16:03:01 +08:00

Compute average of star ratings

This commit is contained in:
Alex Amadori 2017-02-24 17:01:14 +01:00
parent 51b6075210
commit 90b0f035ad

View File

@ -206,11 +206,20 @@ namespace osu.Game.Screens.Select
case FilterControl.SortMode.Difficulty: case FilterControl.SortMode.Difficulty:
groups.Sort((x, y) => groups.Sort((x, y) =>
{ {
/*TODO: replace with star rating once implemented float x_average=0, y_average=0;
* Assumes BeatmapSets not to be grouped - or to be by difficulty, int counter=0;
* otherwise this sorting makes little sense - or does it? */ foreach (BeatmapInfo set in x.BeatmapSet.Beatmaps) {
if (x.BeatmapSet.Beatmaps.First().StarDifficulty > x_average += set.StarDifficulty;
y.BeatmapSet.Beatmaps.First().StarDifficulty) counter++;
}
x_average /= counter;
counter = 0;
foreach (BeatmapInfo set in y.BeatmapSet.Beatmaps) {
y_average += set.StarDifficulty;
counter++;
}
y_average /= counter;
if (x_average > y_average)
return 1; return 1;
else else
return -1; return -1;