Normalize country code to UK instead of GB

- CountriesTool: use 'uk' key for United Kingdom
- EGFRatingsHandler: keep UK as-is (no conversion to GB)
- Pairable: convert GB to UK (inverse of previous behavior)
This commit is contained in:
Claude Brisson
2025-11-29 12:30:15 +01:00
parent cbadb4d6bb
commit 4daa707f3e
3 changed files with 3 additions and 6 deletions

View File

@@ -107,9 +107,9 @@ fun Player.Companion.fromJson(json: Json.Object, default: Player? = null) = Play
rating = json.getInt("rating") ?: default?.rating ?: badRequest("missing rating"),
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
// normalize to UK (EGF uses UK, ISO uses GB)
val up = it.uppercase(Locale.ROOT)
if (up == "UK") "GB" else up
if (up == "GB") "UK" else up
},
club = json.getString("club") ?: default?.club ?: badRequest("missing club"),
final = json.getBoolean("final") ?: default?.final ?: true,