Update tournament migration logic to check for null `Country`

This commit is contained in:
Salman Ahmed 2022-07-16 04:06:48 +03:00
parent 1b2b42bb8a
commit b2b2a4adaf
2 changed files with 5 additions and 2 deletions

View File

@ -22,7 +22,8 @@ public class TournamentUser : IUser
/// <summary>
/// The player's country.
/// </summary>
public Country? Country { get; set; }
[JsonProperty("country_code")]
public Country Country { get; set; }
/// <summary>
/// The player's global rank, or null if not available.

View File

@ -186,7 +186,9 @@ private bool addPlayers()
{
var playersRequiringPopulation = ladder.Teams
.SelectMany(t => t.Players)
.Where(p => string.IsNullOrEmpty(p.Username) || p.Rank == null).ToList();
.Where(p => string.IsNullOrEmpty(p.Username)
|| p.Country == default
|| p.Rank == null).ToList();
if (playersRequiringPopulation.Count == 0)
return false;