diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
index 5a3996bb49..35816fe620 100644
--- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
+++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
@@ -49,16 +49,33 @@ namespace osu.Game.Screens.Select.Carousel
return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
case SortMode.BPM:
- return BeatmapSet.MaxBPM.CompareTo(otherSet.BeatmapSet.MaxBPM);
+ return compareUsingAggregateMax(otherSet, b => b.BPM);
case SortMode.Length:
- return BeatmapSet.MaxLength.CompareTo(otherSet.BeatmapSet.MaxLength);
+ return compareUsingAggregateMax(otherSet, b => b.Length);
case SortMode.Difficulty:
- return BeatmapSet.MaxStarDifficulty.CompareTo(otherSet.BeatmapSet.MaxStarDifficulty);
+ return compareUsingAggregateMax(otherSet, b => b.StarDifficulty);
}
}
+ ///
+ /// All beatmaps which are not filtered and valid for display.
+ ///
+ protected IEnumerable ValidBeatmaps => Beatmaps.Where(b => !b.Filtered.Value).Select(b => b.Beatmap);
+
+ private int compareUsingAggregateMax(CarouselBeatmapSet other, Func func)
+ {
+ var ourBeatmaps = ValidBeatmaps.Any();
+ var otherBeatmaps = other.ValidBeatmaps.Any();
+
+ if (!ourBeatmaps && !otherBeatmaps) return 0;
+ if (!ourBeatmaps) return -1;
+ if (!otherBeatmaps) return 1;
+
+ return ValidBeatmaps.Max(func).CompareTo(other.ValidBeatmaps.Max(func));
+ }
+
public override void Filter(FilterCriteria criteria)
{
base.Filter(criteria);
diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs
index 6ebd2d41cc..09b728abeb 100644
--- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs
+++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs
@@ -83,8 +83,8 @@ namespace osu.Game.Screens.Select.Carousel
var children = new List(InternalChildren);
- children.Sort((x, y) => x.CompareTo(criteria, y));
children.ForEach(c => c.Filter(criteria));
+ children.Sort((x, y) => x.CompareTo(criteria, y));
InternalChildren = children;
}