mirror of https://github.com/ppy/osu
Merge pull request #24235 from AkiSakurai/toplocalrank
Compute the top local rank directly without an expensive detach call
This commit is contained in:
commit
2d51aa21b7
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue