Defaults players country codes to uppercase

This commit is contained in:
Claude Brisson
2024-03-25 14:56:13 +01:00
parent 4c82398ac0
commit 29ffca6616

View File

@@ -109,7 +109,8 @@ fun Player.Companion.fromJson(json: Json.Object, default: Player? = null) = Play
rank = json.getInt("rank") ?: default?.rank ?: badRequest("missing rank"),
country = ( json.getString("country") ?: default?.country ?: badRequest("missing country") ).let {
// EGC uses UK, while FFG and browser language use GB
if (it == "UK") "GB" else it
val up = it.uppercase(Locale.ROOT)
if (up == "UK") "GB" else up
},
club = json.getString("club") ?: default?.club ?: badRequest("missing club"),
final = json.getBoolean("final") ?: default?.final ?: true,