Skip to content

Commit

Permalink
Merge pull request #24235 from AkiSakurai/toplocalrank
Browse files Browse the repository at this point in the history
Compute the top local rank directly without an expensive detach call
  • Loading branch information
peppy authored Jul 16, 2023
2 parents cf70f5e + cb35468 commit 2d51aa2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions osu.Game/Screens/Select/Carousel/TopLocalRank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ void localScoresChanged(IRealmCollection<ScoreInfo> sender, ChangeSet? changes)
if (changes?.HasCollectionChanges() == false)
return;

ScoreInfo? topScore = sender.Detach().OrderByTotalScore().FirstOrDefault();

ScoreInfo? topScore = sender.MaxBy(info => (info.TotalScore, -info.Date.UtcDateTime.Ticks));
updateable.Rank = topScore?.Rank;
updateable.Alpha = topScore != null ? 1 : 0;
}
Expand Down

0 comments on commit 2d51aa2

Please sign in to comment.