1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:02:55 +08:00

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
commit ed4577a130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 25 deletions

View File

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

View File

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

View File

@ -150,7 +150,9 @@ namespace osu.Game.Tournament
{
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);
addedInfo = true;

View File

@ -244,7 +244,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
return unsorted.OrderByDescending(u => u.LastVisit).ToList();
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:
return unsorted.OrderBy(u => u.Username).ToList();

View File

@ -72,9 +72,6 @@ namespace osu.Game.Users
[JsonProperty(@"support_level")]
public int SupportLevel;
[JsonProperty(@"current_mode_rank")]
public int? CurrentModeRank;
[JsonProperty(@"is_gmt")]
public bool IsGMT;
@ -182,7 +179,7 @@ namespace osu.Game.Users
private UserStatistics statistics;
/// <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.
/// </summary>
[JsonProperty(@"statistics")]

View File

@ -29,16 +29,9 @@ namespace osu.Game.Users
[JsonProperty(@"global_rank")]
public int? GlobalRank;
[JsonProperty(@"country_rank")]
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.
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
}
}