mirror of
https://github.com/ppy/osu.git
synced 2025-03-10 19:37:19 +08:00
Fix playlists results screens potentially displaying negative score positions
Closes https://github.com/ppy/osu/issues/31434.
This commit is contained in:
parent
28f9e734f0
commit
bf4fa58f72
@ -185,6 +185,24 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
{
|
{
|
||||||
higherScores = index;
|
higherScores = index;
|
||||||
setPositions(index, pivot, -1);
|
setPositions(index, pivot, -1);
|
||||||
|
|
||||||
|
// when paginating the results, it's possible for the user's score to naturally fall down the rankings.
|
||||||
|
// unmitigated, this can cause scores at the very top of the rankings to have zero or negative positions
|
||||||
|
// because the positions are counted backwards from the user's score, which has increased in this case during pagination.
|
||||||
|
// if this happens, just give the top score the first position.
|
||||||
|
// note that this isn't 100% correct, but it *is* however the most reliable way to mask the problem.
|
||||||
|
int smallestPosition = index.Scores.Min(s => s.Position ?? 1);
|
||||||
|
|
||||||
|
if (smallestPosition < 1)
|
||||||
|
{
|
||||||
|
int offset = 1 - smallestPosition;
|
||||||
|
|
||||||
|
foreach (var scorePanel in ScorePanelList.GetScorePanels())
|
||||||
|
scorePanel.ScorePosition.Value += offset;
|
||||||
|
|
||||||
|
foreach (var score in index.Scores)
|
||||||
|
score.Position += offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await transformScores(index.Scores).ConfigureAwait(false);
|
return await transformScores(index.Scores).ConfigureAwait(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user