From c8bfb34117b47c0d701fb80596bc6e6bca152ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 15 May 2026 10:03:21 +0200 Subject: [PATCH] Use truncation to 2dp of star rating in ranked play card to be consistent with everything else (#37756) Closes https://github.com/ppy/osu/issues/37755. --- osu.Game.Tests/Visual/RankedPlay/TestSceneRankedPlayCard.cs | 4 +++- .../RankedPlay/Card/RankedPlayCardContent.Metadata.cs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/RankedPlay/TestSceneRankedPlayCard.cs b/osu.Game.Tests/Visual/RankedPlay/TestSceneRankedPlayCard.cs index a1a449b703..7f2c87bed0 100644 --- a/osu.Game.Tests/Visual/RankedPlay/TestSceneRankedPlayCard.cs +++ b/osu.Game.Tests/Visual/RankedPlay/TestSceneRankedPlayCard.cs @@ -108,7 +108,9 @@ namespace osu.Game.Tests.Visual.RankedPlay Retries = Enumerable.Range(-2, 100).Select(x => x % 12 - 6).ToArray(), }; - beatmap.StarRating = i + 1; + // the .009 part exercises behaviour of truncating star rating to 2dp + // it should be discarded completely on display + beatmap.StarRating = i + 1.009; flow.Add(new RankedPlayCardContent(beatmap) { diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCardContent.Metadata.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCardContent.Metadata.cs index 2b935acca6..3e1b880d81 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCardContent.Metadata.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCardContent.Metadata.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -12,6 +11,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Utils; using osuTK; namespace osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Card @@ -107,7 +107,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Card }, new TruncatingSpriteText { - Text = FormattableString.Invariant($"{beatmap.StarRating:F2}"), + Text = beatmap.StarRating.FormatStarRating(), Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Font = OsuFont.GetFont(size: 9, weight: FontWeight.Bold),