From 63b5ffe8fe5f806ce261b494af5aa6f216d784d7 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 16 Apr 2026 13:08:11 +0900 Subject: [PATCH 1/2] Work around rating data not always including user --- .../TestSceneRatingDistributionGraph.cs | 22 +++++++++++++++++++ .../Queue/RatingDistributionGraph.cs | 12 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/osu.Game.Tests/Visual/Matchmaking/TestSceneRatingDistributionGraph.cs b/osu.Game.Tests/Visual/Matchmaking/TestSceneRatingDistributionGraph.cs index b9c2e979a5c9..102668ec9da5 100644 --- a/osu.Game.Tests/Visual/Matchmaking/TestSceneRatingDistributionGraph.cs +++ b/osu.Game.Tests/Visual/Matchmaking/TestSceneRatingDistributionGraph.cs @@ -61,6 +61,28 @@ public void TestNoData() AddStep("set empty data", () => graph.SetData([], null)); } + [Test] + public void TestOutOfBoundsUserRating() + { + AddStep("set data with max user rating", () => + { + List<(int x, int y)> values = new List<(int x, int y)>(); + for (int i = 400; i <= 2800; i += 100) + values.Add((i, (int)Math.Round(generateCount(i, 1600, 400, 7200)))); + + graph.SetData(values.ToArray(), 4000); + }); + + AddStep("set data with min user rating", () => + { + List<(int x, int y)> values = new List<(int x, int y)>(); + for (int i = 400; i <= 2800; i += 100) + values.Add((i, (int)Math.Round(generateCount(i, 1600, 400, 7200)))); + + graph.SetData(values.ToArray(), 0); + }); + } + private static double generateCount(double x, double mean, double stdDev, double amplitude) { return amplitude * Math.Exp(-Math.Pow(x - mean, 2) / (2 * Math.Pow(stdDev, 2))) + Random.Shared.Next(300); diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/RatingDistributionGraph.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/RatingDistributionGraph.cs index aba47e959132..b85b379ce317 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/RatingDistributionGraph.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/RatingDistributionGraph.cs @@ -241,6 +241,18 @@ public void SetData((int x, int y)[] data, int? userRating) (int)roundToSignificant(data.Select(d => d.y).DefaultIfEmpty().Max()) ); + if (userRating < xRange.min) + { + this.data = this.data.Prepend((userRating.Value, 1)).ToArray(); + xRange.min = userRating.Value; + } + + if (userRating > xRange.max) + { + this.data = this.data.Append((userRating.Value, 1)).ToArray(); + xRange.max = userRating.Value; + } + updateGraph(); } From 2c56a562d68f7526d0dcaacf3e2bb2c463d3d1ba Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 16 Apr 2026 13:18:45 +0900 Subject: [PATCH 2/2] Fix case where only user rating is present --- .../Matchmaking/TestSceneRatingDistributionGraph.cs | 9 +++++++++ .../Matchmaking/Queue/RatingDistributionGraph.cs | 10 +++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Matchmaking/TestSceneRatingDistributionGraph.cs b/osu.Game.Tests/Visual/Matchmaking/TestSceneRatingDistributionGraph.cs index 102668ec9da5..6f4d9aa9b7dc 100644 --- a/osu.Game.Tests/Visual/Matchmaking/TestSceneRatingDistributionGraph.cs +++ b/osu.Game.Tests/Visual/Matchmaking/TestSceneRatingDistributionGraph.cs @@ -81,6 +81,15 @@ public void TestOutOfBoundsUserRating() graph.SetData(values.ToArray(), 0); }); + + AddStep("set data with only user rating", () => + { + List<(int x, int y)> values = new List<(int x, int y)>(); + for (int i = 400; i <= 2800; i += 100) + values.Add((i, (int)Math.Round(generateCount(i, 1600, 400, 7200)))); + + graph.SetData([], 1500); + }); } private static double generateCount(double x, double mean, double stdDev, double amplitude) diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/RatingDistributionGraph.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/RatingDistributionGraph.cs index b85b379ce317..d4d4a83eb693 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/RatingDistributionGraph.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Queue/RatingDistributionGraph.cs @@ -236,11 +236,6 @@ public void SetData((int x, int y)[] data, int? userRating) data.Zip(data.Skip(1), (a, b) => Math.Abs(b.x - a.x)).DefaultIfEmpty().Min() ); - yRange = ( - 0, - (int)roundToSignificant(data.Select(d => d.y).DefaultIfEmpty().Max()) - ); - if (userRating < xRange.min) { this.data = this.data.Prepend((userRating.Value, 1)).ToArray(); @@ -253,6 +248,11 @@ public void SetData((int x, int y)[] data, int? userRating) xRange.max = userRating.Value; } + yRange = ( + 0, + (int)roundToSignificant(this.data.Select(d => d.y).DefaultIfEmpty().Max()) + ); + updateGraph(); }