Merge pull request #4542 from smoogipoo/convert-ranking-statistics

Fix incorrect statistics being shown in results

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2019-03-29 12:59:44 +09:00 committed by GitHub
commit ad44116845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 37 deletions

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.BeatmapSet.Scores; using osu.Game.Overlays.BeatmapSet.Scores;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
@ -44,9 +43,9 @@ namespace osu.Game.Tests.Visual.SongSelect
} }
}; };
IEnumerable<APIScoreInfo> scores = new[] IEnumerable<ScoreInfo> scores = new[]
{ {
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -69,7 +68,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 1234567890, TotalScore = 1234567890,
Accuracy = 1, Accuracy = 1,
}, },
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -91,7 +90,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 1234789, TotalScore = 1234789,
Accuracy = 0.9997, Accuracy = 0.9997,
}, },
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -112,7 +111,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 12345678, TotalScore = 12345678,
Accuracy = 0.9854, Accuracy = 0.9854,
}, },
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -132,7 +131,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 1234567, TotalScore = 1234567,
Accuracy = 0.8765, Accuracy = 0.8765,
}, },
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -157,9 +156,9 @@ namespace osu.Game.Tests.Visual.SongSelect
s.Statistics.Add(HitResult.Meh, RNG.Next(2000)); s.Statistics.Add(HitResult.Meh, RNG.Next(2000));
} }
IEnumerable<APIScoreInfo> anotherScores = new[] IEnumerable<ScoreInfo> anotherScores = new[]
{ {
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -181,7 +180,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 1234789, TotalScore = 1234789,
Accuracy = 0.9997, Accuracy = 0.9997,
}, },
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -204,7 +203,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 1234567890, TotalScore = 1234567890,
Accuracy = 1, Accuracy = 1,
}, },
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -220,7 +219,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 123456, TotalScore = 123456,
Accuracy = 0.6543, Accuracy = 0.6543,
}, },
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -241,7 +240,7 @@ namespace osu.Game.Tests.Visual.SongSelect
TotalScore = 12345678, TotalScore = 12345678,
Accuracy = 0.9854, Accuracy = 0.9854,
}, },
new APIScoreInfo new ScoreInfo
{ {
User = new User User = new User
{ {
@ -269,7 +268,7 @@ namespace osu.Game.Tests.Visual.SongSelect
s.Statistics.Add(HitResult.Meh, RNG.Next(2000)); s.Statistics.Add(HitResult.Meh, RNG.Next(2000));
} }
var topScoreInfo = new APIScoreInfo var topScoreInfo = new ScoreInfo
{ {
User = new User User = new User
{ {

View File

@ -10,7 +10,7 @@ using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class GetScoresRequest : APIRequest<APIScores> public class GetScoresRequest : APIRequest<APILegacyScores>
{ {
private readonly BeatmapInfo beatmap; private readonly BeatmapInfo beatmap;
private readonly BeatmapLeaderboardScope scope; private readonly BeatmapLeaderboardScope scope;
@ -31,9 +31,9 @@ namespace osu.Game.Online.API.Requests
Success += onSuccess; Success += onSuccess;
} }
private void onSuccess(APIScores r) private void onSuccess(APILegacyScores r)
{ {
foreach (APIScoreInfo score in r.Scores) foreach (APILegacyScoreInfo score in r.Scores)
score.Beatmap = beatmap; score.Beatmap = beatmap;
} }

View File

@ -6,7 +6,7 @@ using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class GetUserScoresRequest : APIRequest<List<APIScoreInfo>> public class GetUserScoresRequest : APIRequest<List<APILegacyScoreInfo>>
{ {
private readonly long userId; private readonly long userId;
private readonly ScoreType type; private readonly ScoreType type;

View File

@ -8,12 +8,12 @@ using Newtonsoft.Json;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring.Legacy;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Online.API.Requests.Responses namespace osu.Game.Online.API.Requests.Responses
{ {
public class APIScoreInfo : ScoreInfo public class APILegacyScoreInfo : LegacyScoreInfo
{ {
[JsonProperty(@"score")] [JsonProperty(@"score")]
private int totalScore private int totalScore
@ -74,29 +74,37 @@ namespace osu.Game.Online.API.Requests.Responses
HitResult newKey; HitResult newKey;
switch (kvp.Key) switch (kvp.Key)
{ {
case @"count_geki":
CountGeki = kvp.Value;
break;
case @"count_300": case @"count_300":
newKey = HitResult.Great; Count300 = kvp.Value;
break;
case @"count_katu":
CountKatu = kvp.Value;
break; break;
case @"count_100": case @"count_100":
newKey = HitResult.Good; Count100 = kvp.Value;
break; break;
case @"count_50": case @"count_50":
newKey = HitResult.Meh; Count50 = kvp.Value;
break; break;
case @"count_miss": case @"count_miss":
newKey = HitResult.Miss; CountMiss = kvp.Value;
break; break;
default: default:
continue; continue;
} }
Statistics.Add(newKey, kvp.Value);
} }
} }
} }
[JsonProperty(@"mode_int")] [JsonProperty(@"mode_int")]
public int OnlineRulesetID { get; set; } public int OnlineRulesetID
{
get => RulesetID;
set => RulesetID = value;
}
[JsonProperty(@"mods")] [JsonProperty(@"mods")]
private string[] modStrings { get; set; } private string[] modStrings { get; set; }

View File

@ -6,9 +6,9 @@ using Newtonsoft.Json;
namespace osu.Game.Online.API.Requests.Responses namespace osu.Game.Online.API.Requests.Responses
{ {
public class APIScores public class APILegacyScores
{ {
[JsonProperty(@"scores")] [JsonProperty(@"scores")]
public IEnumerable<APIScoreInfo> Scores; public IEnumerable<APILegacyScoreInfo> Scores;
} }
} }

View File

@ -9,12 +9,12 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards; using osu.Game.Online.Leaderboards;
using osu.Game.Overlays.Profile.Sections.Ranks; using osu.Game.Overlays.Profile.Sections.Ranks;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Overlays.BeatmapSet.Scores namespace osu.Game.Overlays.BeatmapSet.Scores
@ -26,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private readonly Box background; private readonly Box background;
public DrawableScore(int index, APIScoreInfo score) public DrawableScore(int index, ScoreInfo score)
{ {
ScoreModsContainer modsContainer; ScoreModsContainer modsContainer;

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards; using osu.Game.Online.Leaderboards;
using osu.Game.Overlays.Profile.Sections.Ranks; using osu.Game.Overlays.Profile.Sections.Ranks;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -43,9 +42,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private readonly InfoColumn statistics; private readonly InfoColumn statistics;
private readonly ScoreModsContainer modsContainer; private readonly ScoreModsContainer modsContainer;
private APIScoreInfo score; private ScoreInfo score;
public APIScoreInfo Score public ScoreInfo Score
{ {
get => score; get => score;
set set

View File

@ -11,7 +11,7 @@ using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Scoring;
namespace osu.Game.Overlays.BeatmapSet.Scores namespace osu.Game.Overlays.BeatmapSet.Scores
{ {
@ -29,10 +29,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
set => loadingAnimation.FadeTo(value ? 1 : 0, fade_duration); set => loadingAnimation.FadeTo(value ? 1 : 0, fade_duration);
} }
private IEnumerable<APIScoreInfo> scores; private IEnumerable<ScoreInfo> scores;
private BeatmapInfo beatmap; private BeatmapInfo beatmap;
public IEnumerable<APIScoreInfo> Scores public IEnumerable<ScoreInfo> Scores
{ {
get => scores; get => scores;
set set