From f889f2435bc83cebb783c37a31d49319fac505d8 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Tue, 4 Feb 2020 16:20:15 +0300 Subject: [PATCH] Add test step to TestSceneRankingsTable --- .../Visual/Online/TestSceneRankingsTables.cs | 15 +++++++++++++++ .../Overlays/Rankings/Tables/UserBasedTable.cs | 4 ++-- osu.Game/Users/UserStatistics.cs | 8 ++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs index ab174f303e..19ca63208e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs @@ -68,6 +68,7 @@ namespace osu.Game.Tests.Visual.Online AddStep("Mania scores", () => createScoreTable(new ManiaRuleset().RulesetInfo)); AddStep("Taiko country scores", () => createCountryTable(new TaikoRuleset().RulesetInfo)); AddStep("Catch US performance page 10", () => createPerformanceTable(new CatchRuleset().RulesetInfo, "US", 10)); + AddStep("Osu 271 spotlight table", () => createSpotlightTable(new OsuRuleset().RulesetInfo, 271)); } private void createCountryTable(RulesetInfo ruleset, int page = 1) @@ -112,6 +113,20 @@ namespace osu.Game.Tests.Visual.Online api.Queue(request); } + private void createSpotlightTable(RulesetInfo ruleset, int spotlight) + { + onLoadStarted(); + + request = new GetSpotlightRankingsRequest(ruleset, spotlight); + ((GetSpotlightRankingsRequest)request).Success += rankings => Schedule(() => + { + var table = new ScoresTable(1, rankings.Users); + loadTable(table); + }); + + api.Queue(request); + } + private void onLoadStarted() { loading.Show(); diff --git a/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs b/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs index 351c4df6b7..e1395479f2 100644 --- a/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/UserBasedTable.cs @@ -44,8 +44,8 @@ namespace osu.Game.Overlays.Rankings.Tables new ColoredRowText { Text = $@"{item.PlayCount:N0}", }, }.Concat(CreateUniqueContent(item)).Concat(new[] { - new ColoredRowText { Text = $@"{item.GradesCount.SS + item.GradesCount.SSPlus:N0}", }, - new ColoredRowText { Text = $@"{item.GradesCount.S + item.GradesCount.SPlus:N0}", }, + new ColoredRowText { Text = $@"{item.GradesCount.SS + (item.GradesCount.SSPlus ?? 0):N0}", }, + new ColoredRowText { Text = $@"{item.GradesCount.S + (item.GradesCount.SPlus ?? 0):N0}", }, new ColoredRowText { Text = $@"{item.GradesCount.A:N0}", } }).ToArray(); diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index e5e77821ab..8ce26074a8 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -30,7 +30,7 @@ namespace osu.Game.Users public decimal? PP; [JsonProperty(@"pp_rank")] // the API sometimes only returns this value in condensed user responses - private int rank + private int? rank { set => Ranks.Global = value; } @@ -71,13 +71,13 @@ namespace osu.Game.Users public struct Grades { [JsonProperty(@"ssh")] - public int SSPlus; + public int? SSPlus; [JsonProperty(@"ss")] public int SS; [JsonProperty(@"sh")] - public int SPlus; + public int? SPlus; [JsonProperty(@"s")] public int S; @@ -85,7 +85,7 @@ namespace osu.Game.Users [JsonProperty(@"a")] public int A; - public int this[ScoreRank rank] + public int? this[ScoreRank rank] { get {