From 29ffca6616b05e0c02db471bc0748654fc567503 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Mon, 25 Mar 2024 14:56:13 +0100 Subject: [PATCH] Defaults players country codes to uppercase --- .../src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt index 3c8994d..0fbaa15 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt @@ -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,