From d93911ae9745ac56692e90f6ad9c63f6c7b907f3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Nov 2017 18:09:42 +0900 Subject: [PATCH 1/3] Improve user ratings calculations to make more sense Closes #1552. --- osu.Game/Beatmaps/BeatmapMetrics.cs | 2 +- osu.Game/Graphics/UserInterface/Bar.cs | 3 ++- osu.Game/Screens/Select/Details/UserRatings.cs | 16 +++++++++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapMetrics.cs b/osu.Game/Beatmaps/BeatmapMetrics.cs index 730cf635da..e0cd5f10e7 100644 --- a/osu.Game/Beatmaps/BeatmapMetrics.cs +++ b/osu.Game/Beatmaps/BeatmapMetrics.cs @@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps public class BeatmapMetrics { /// - /// Total vote counts of user ratings on a scale of 0..length. + /// Total vote counts of user ratings on a scale of 0..10 where 0 is unused (probably will be fixed at API?). /// public IEnumerable Ratings { get; set; } diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 20df553142..c25a9bf5e9 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -20,6 +20,7 @@ namespace osu.Game.Graphics.UserInterface private const Easing easing = Easing.InOutCubic; private float length; + /// /// Length of the bar, ranges from 0 to 1 /// @@ -134,4 +135,4 @@ namespace osu.Game.Graphics.UserInterface Vertical = TopToBottom | BottomToTop, Horizontal = LeftToRight | RightToLeft, } -} \ No newline at end of file +} diff --git a/osu.Game/Screens/Select/Details/UserRatings.cs b/osu.Game/Screens/Select/Details/UserRatings.cs index 2153eb150c..0741407049 100644 --- a/osu.Game/Screens/Select/Details/UserRatings.cs +++ b/osu.Game/Screens/Select/Details/UserRatings.cs @@ -29,11 +29,17 @@ namespace osu.Game.Screens.Select.Details if (value == metrics) return; metrics = value; - var ratings = Metrics.Ratings.ToList(); - negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2 + 1).Sum().ToString(); - positiveRatings.Text = ratings.GetRange(ratings.Count / 2 + 1, ratings.Count / 2).Sum().ToString(); - ratingsBar.Length = (float)ratings.GetRange(0, ratings.Count / 2 + 1).Sum() / ratings.Sum(); - graph.Values = Metrics.Ratings.Select(r => (float)r); + const int rating_range = 10; + + var ratings = Metrics.Ratings.ToList().GetRange(1, rating_range); // adjust for API returning weird empty data at 0. + + var negativeCount = ratings.GetRange(0, rating_range / 2).Sum(); + var totalCount = ratings.Sum(); + + negativeRatings.Text = negativeCount.ToString(); + positiveRatings.Text = (totalCount - negativeCount).ToString(); + ratingsBar.Length = (float)negativeCount / totalCount; + graph.Values = ratings.GetRange(0, rating_range).Select(r => (float)r); } } From dbb03bcff28ead54b2d0239b2847aba012c5a411 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Nov 2017 23:30:57 +0900 Subject: [PATCH 2/3] Handle the case where a map hasn't been rated yet --- osu.Game/Screens/Select/Details/UserRatings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Details/UserRatings.cs b/osu.Game/Screens/Select/Details/UserRatings.cs index 0741407049..997e0baec3 100644 --- a/osu.Game/Screens/Select/Details/UserRatings.cs +++ b/osu.Game/Screens/Select/Details/UserRatings.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Select.Details negativeRatings.Text = negativeCount.ToString(); positiveRatings.Text = (totalCount - negativeCount).ToString(); - ratingsBar.Length = (float)negativeCount / totalCount; + ratingsBar.Length = totalCount == 0 ? 0 : (float)negativeCount / totalCount; graph.Values = ratings.GetRange(0, rating_range).Select(r => (float)r); } } From 11d406aa0c2d3acaf6137538af20f9de85d41639 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Nov 2017 11:49:10 +0900 Subject: [PATCH 3/3] Fix osu!catch conversion expecting full positional data, rather than just X. Closes #1367. --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 0e4935aa7a..7126b6586d 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps protected override IEnumerable ConvertHitObject(HitObject obj, Beatmap beatmap) { var curveData = obj as IHasCurve; - var positionData = obj as IHasPosition; + var positionData = obj as IHasXPosition; var comboData = obj as IHasCombo; if (positionData == null)