Code cleanup

This commit is contained in:
Claude Brisson
2024-07-13 11:45:54 +02:00
parent 13e878c0ce
commit bbf0308994

View File

@@ -31,10 +31,10 @@ object EGFRatingsHandler: RatingsHandler(RatingsManager.Ratings.EGF) {
player["origin"] = "EGF"
// override rank with rating equivalent
player["rating"]?.toString()?.toIntOrNull()?.let { rating ->
val rank = (rating - 2050.0) / 100.0
val adjusted = rating - 2050;
player["rank"] =
if (rank < 0) "${-floor(rank).toInt()}k"
else "${ceil(rank + 0.00001).toInt()}d"
if (adjusted < 0) "${-(adjusted - 99) / 100}k"
else "${(adjusted + 100) / 100}d"
}
if ("UK" == player.getString("country")) {
player["country"] = "GB"