-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix toolbar PP change showing +0
instead of 0
#29512
Conversation
peppy
commented
Aug 19, 2024
Before | After |
---|---|
@@ -83,7 +83,7 @@ protected override void LoadComplete() | |||
} | |||
|
|||
if (update.After.PP != null) | |||
pp.Display(update.Before.PP ?? update.After.PP.Value, Math.Abs((update.After.PP - update.Before.PP) ?? 0M), update.After.PP.Value); | |||
pp.Display((int)(update.Before.PP ?? update.After.PP.Value), (int)Math.Abs((update.After.PP - update.Before.PP) ?? 0M), (int)update.After.PP.Value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can still have green +0
show with this because flooring/truncating thrice separately is not guaranteed to give you consistent results.
Example: User goes from +0
on the delta.
Can be crudely tested with
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbarUserButton.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbarUserButton.cs
index a81c940d82..3d18dc5ebc 100644
--- a/osu.Game.Tests/Visual/Menus/TestSceneToolbarUserButton.cs
+++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbarUserButton.cs
@@ -137,12 +137,12 @@ public void TestTransientUserStatisticsDisplay()
new UserStatistics
{
GlobalRank = 111_111,
- PP = 1357
+ PP = 1357.6m
},
new UserStatistics
{
GlobalRank = 111_111,
- PP = 1357.1m
+ PP = 1358.1m
});
});
AddStep("Was null", () =>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to do (int)after - (int)before
on the second argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably fine.