Merge pull request #11940 from frenzibyte/migrate-country-rank

This commit is contained in:
Dean Herbert
2021-03-08 11:57:35 +09:00
committed by GitHub
6 changed files with 9 additions and 25 deletions

View File

@ -51,7 +51,7 @@ namespace osu.Game.Tests.Visual.Online
Username = "flyte", Username = "flyte",
Id = 3103765, Id = 3103765,
IsOnline = true, IsOnline = true,
CurrentModeRank = 1111, Statistics = new UserStatistics { GlobalRank = 1111 },
Country = new Country { FlagName = "JP" }, Country = new Country { FlagName = "JP" },
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
}, },
@ -60,7 +60,7 @@ namespace osu.Game.Tests.Visual.Online
Username = "peppy", Username = "peppy",
Id = 2, Id = 2,
IsOnline = false, IsOnline = false,
CurrentModeRank = 2222, Statistics = new UserStatistics { GlobalRank = 2222 },
Country = new Country { FlagName = "AU" }, Country = new Country { FlagName = "AU" },
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
IsSupporter = true, IsSupporter = true,

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Playlists
Room.RecentParticipants.Add(new User Room.RecentParticipants.Add(new User
{ {
Username = "peppy", Username = "peppy",
CurrentModeRank = 1234, Statistics = new UserStatistics { GlobalRank = 1234 },
Id = 2 Id = 2
}); });
} }

View File

@ -150,7 +150,9 @@ namespace osu.Game.Tournament
{ {
foreach (var p in t.Players) foreach (var p in t.Players)
{ {
if (string.IsNullOrEmpty(p.Username) || p.Statistics?.GlobalRank == null) if (string.IsNullOrEmpty(p.Username)
|| p.Statistics?.GlobalRank == null
|| p.Statistics?.CountryRank == null)
{ {
PopulateUser(p, immediate: true); PopulateUser(p, immediate: true);
addedInfo = true; addedInfo = true;

View File

@ -244,7 +244,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
return unsorted.OrderByDescending(u => u.LastVisit).ToList(); return unsorted.OrderByDescending(u => u.LastVisit).ToList();
case UserSortCriteria.Rank: case UserSortCriteria.Rank:
return unsorted.OrderByDescending(u => u.CurrentModeRank.HasValue).ThenBy(u => u.CurrentModeRank ?? 0).ToList(); return unsorted.OrderByDescending(u => u.Statistics.GlobalRank.HasValue).ThenBy(u => u.Statistics.GlobalRank ?? 0).ToList();
case UserSortCriteria.Username: case UserSortCriteria.Username:
return unsorted.OrderBy(u => u.Username).ToList(); return unsorted.OrderBy(u => u.Username).ToList();

View File

@ -72,9 +72,6 @@ namespace osu.Game.Users
[JsonProperty(@"support_level")] [JsonProperty(@"support_level")]
public int SupportLevel; public int SupportLevel;
[JsonProperty(@"current_mode_rank")]
public int? CurrentModeRank;
[JsonProperty(@"is_gmt")] [JsonProperty(@"is_gmt")]
public bool IsGMT; public bool IsGMT;
@ -182,7 +179,7 @@ namespace osu.Game.Users
private UserStatistics statistics; private UserStatistics statistics;
/// <summary> /// <summary>
/// User statistics for the requested ruleset (in the case of a <see cref="GetUserRequest"/> response). /// User statistics for the requested ruleset (in the case of a <see cref="GetUserRequest"/> or <see cref="GetFriendsRequest"/> response).
/// Otherwise empty. /// Otherwise empty.
/// </summary> /// </summary>
[JsonProperty(@"statistics")] [JsonProperty(@"statistics")]

View File

@ -29,16 +29,9 @@ namespace osu.Game.Users
[JsonProperty(@"global_rank")] [JsonProperty(@"global_rank")]
public int? GlobalRank; public int? GlobalRank;
[JsonProperty(@"country_rank")]
public int? CountryRank; public int? CountryRank;
[JsonProperty(@"rank")]
private UserRanks ranks
{
// eventually that will also become an own json property instead of reading from a `rank` object.
// see https://github.com/ppy/osu-web/blob/cb79bb72186c8f1a25f6a6f5ef315123decb4231/app/Transformers/UserStatisticsTransformer.php#L53.
set => CountryRank = value.Country;
}
// populated via User model, as that's where the data currently lives. // populated via User model, as that's where the data currently lives.
public RankHistoryData RankHistory; public RankHistoryData RankHistory;
@ -119,13 +112,5 @@ namespace osu.Game.Users
} }
} }
} }
#pragma warning disable 649
private struct UserRanks
{
[JsonProperty(@"country")]
public int? Country;
}
#pragma warning restore 649
} }
} }