mirror of https://github.com/ppy/osu
Use nullable comparison helper method instead of manual implementation
This commit is contained in:
parent
a14dede036
commit
87d0bef313
|
@ -87,7 +87,7 @@ public override int CompareTo(FilterCriteria criteria, CarouselItem other)
|
|||
break;
|
||||
|
||||
case SortMode.DateRanked:
|
||||
comparison = compareNullableDateTimeOffset(BeatmapSet.DateRanked, otherSet.BeatmapSet.DateRanked);
|
||||
comparison = Nullable.Compare(otherSet.BeatmapSet.DateRanked, BeatmapSet.DateRanked);
|
||||
break;
|
||||
|
||||
case SortMode.LastPlayed:
|
||||
|
@ -107,7 +107,7 @@ public override int CompareTo(FilterCriteria criteria, CarouselItem other)
|
|||
break;
|
||||
|
||||
case SortMode.DateSubmitted:
|
||||
comparison = compareNullableDateTimeOffset(BeatmapSet.DateSubmitted, otherSet.BeatmapSet.DateSubmitted);
|
||||
comparison = Nullable.Compare(otherSet.BeatmapSet.DateSubmitted, BeatmapSet.DateSubmitted);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -124,14 +124,6 @@ public override int CompareTo(FilterCriteria criteria, CarouselItem other)
|
|||
return otherSet.BeatmapSet.ID.CompareTo(BeatmapSet.ID);
|
||||
}
|
||||
|
||||
private static int compareNullableDateTimeOffset(DateTimeOffset? x, DateTimeOffset? y)
|
||||
{
|
||||
if (x == null) return 1;
|
||||
if (y == null) return -1;
|
||||
|
||||
return y.Value.CompareTo(x.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All beatmaps which are not filtered and valid for display.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue