From a3e3bfac62d2b0ad12cd9142083aa97a994b0839 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Sun, 10 Mar 2024 14:31:59 +0100 Subject: [PATCH] Add tournament director field --- .../org/jeudego/pairgoth/ext/OpenGotha.kt | 3 ++- .../org/jeudego/pairgoth/model/Tournament.kt | 10 ++++++++-- .../src/main/webapp/WEB-INF/translations/fr | 1 + .../main/webapp/js/tour-information.inc.js | 1 + .../src/main/webapp/tour-information.inc.html | 19 ++++++++++++------- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt index 9ac3221..96a6926 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt @@ -127,6 +127,7 @@ object OpenGotha { shortName = genParams.shortName, startDate = genParams.beginDate.toLocalDate(), endDate = genParams.endDate.toLocalDate(), + director = genParams.director, country = "fr", // no country in opengotha format location = genParams.location, online = genParams.isBInternet ?: false, @@ -298,7 +299,7 @@ object OpenGotha { TimeSystem.TimeSystemType.JAPANESE -> "STDBYOYOMI" TimeSystem.TimeSystemType.CANADIAN -> "CANBYOYOMI" TimeSystem.TimeSystemType.FISCHER -> "FISCHER" - } }" director="" endDate="${tournament.endDate}" fischerTime="${tournament.timeSystem.increment}" genCountNotPlayedGamesAsHalfPoint="false" genMMBar="${ + } }" director="${tournament.director}" endDate="${tournament.endDate}" fischerTime="${tournament.timeSystem.increment}" genCountNotPlayedGamesAsHalfPoint="false" genMMBar="${ displayRank( if (tournament.pairing is MacMahon) tournament.pairing.mmBar else 8 ).uppercase(Locale.ROOT) diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt index d03c34b..7013859 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt @@ -22,6 +22,7 @@ sealed class Tournament ( val shortName: String, val startDate: LocalDate, val endDate: LocalDate, + val director: String, val country: String, val location: String, val online: Boolean, @@ -128,6 +129,7 @@ class StandardTournament( shortName: String, startDate: LocalDate, endDate: LocalDate, + director: String, country: String, location: String, online: Boolean, @@ -137,7 +139,7 @@ class StandardTournament( rules: Rules = Rules.FRENCH, gobanSize: Int = 19, komi: Double = 7.5 -): Tournament(id, type, name, shortName, startDate, endDate, country, location, online, timeSystem, rounds, pairing, rules, gobanSize, komi) { +): Tournament(id, type, name, shortName, startDate, endDate, director, country, location, online, timeSystem, rounds, pairing, rules, gobanSize, komi) { override val players get() = _pairables } @@ -149,6 +151,7 @@ class TeamTournament( shortName: String, startDate: LocalDate, endDate: LocalDate, + director: String, country: String, location: String, online: Boolean, @@ -158,7 +161,7 @@ class TeamTournament( rules: Rules = Rules.FRENCH, gobanSize: Int = 19, komi: Double = 7.5 -): Tournament(id, type, name, shortName, startDate, endDate, country, location, online, timeSystem, rounds, pairing, rules, gobanSize, komi) { +): Tournament(id, type, name, shortName, startDate, endDate, director, country, location, online, timeSystem, rounds, pairing, rules, gobanSize, komi) { companion object {} override val players = mutableMapOf() val teams: MutableMap = _pairables @@ -207,6 +210,7 @@ fun Tournament.Companion.fromJson(json: Json.Object, default: Tournament<*>? = n shortName = json.getString("shortName") ?: default?.shortName ?: badRequest("missing shortName"), startDate = json.getString("startDate")?.let { LocalDate.parse(it) } ?: default?.startDate ?: badRequest("missing startDate"), endDate = json.getString("endDate")?.let { LocalDate.parse(it) } ?: default?.endDate ?: badRequest("missing endDate"), + director = json.getString("director") ?: default?.director ?: "", country = (json.getString("country") ?: default?.country ?: "fr").let { if (it.isEmpty()) "fr" else it }, location = json.getString("location") ?: default?.location ?: badRequest("missing location"), online = json.getBoolean("online") ?: default?.online ?: false, @@ -225,6 +229,7 @@ fun Tournament.Companion.fromJson(json: Json.Object, default: Tournament<*>? = n shortName = json.getString("shortName") ?: default?.shortName ?: badRequest("missing shortName"), startDate = json.getString("startDate")?.let { LocalDate.parse(it) } ?: default?.startDate ?: badRequest("missing startDate"), endDate = json.getString("endDate")?.let { LocalDate.parse(it) } ?: default?.endDate ?: badRequest("missing endDate"), + director = json.getString("director") ?: default?.director ?: "", country = json.getString("country") ?: default?.country ?: badRequest("missing country"), location = json.getString("location") ?: default?.location ?: badRequest("missing location"), online = json.getBoolean("online") ?: default?.online ?: false, @@ -258,6 +263,7 @@ fun Tournament<*>.toJson() = Json.Object( "shortName" to shortName, "startDate" to startDate.toString(), "endDate" to endDate.toString(), + "director" to director, "country" to country, "location" to location, "online" to online, diff --git a/view-webapp/src/main/webapp/WEB-INF/translations/fr b/view-webapp/src/main/webapp/WEB-INF/translations/fr index 7b594db..d22c453 100644 --- a/view-webapp/src/main/webapp/WEB-INF/translations/fr +++ b/view-webapp/src/main/webapp/WEB-INF/translations/fr @@ -32,6 +32,7 @@ Crit Crit Ctr Pays Dates Dates Delete Supprimer +Director Directeur Download Télécharger Download the standalone web interface module which suits your need, then follow Télécharger le module d’interface web qui correspond à vos besoins, puis suivez Edit Éditer diff --git a/view-webapp/src/main/webapp/js/tour-information.inc.js b/view-webapp/src/main/webapp/js/tour-information.inc.js index 439ad45..5b67e77 100644 --- a/view-webapp/src/main/webapp/js/tour-information.inc.js +++ b/view-webapp/src/main/webapp/js/tour-information.inc.js @@ -160,6 +160,7 @@ onLoad(() => { shortName: form.val('shortName'), startDate: parseDate(form.val('startDate')), endDate: parseDate(form.val('endDate')), + director: form.val('director'), type: form.val('type'), rounds: form.val('rounds'), country: form.val('country'), diff --git a/view-webapp/src/main/webapp/tour-information.inc.html b/view-webapp/src/main/webapp/tour-information.inc.html index 2db1426..2986508 100644 --- a/view-webapp/src/main/webapp/tour-information.inc.html +++ b/view-webapp/src/main/webapp/tour-information.inc.html @@ -14,16 +14,21 @@
-
+
- from + from + + + to + + + +
+
+ - - to - - - +