Add tournament director field

This commit is contained in:
Claude Brisson
2024-03-10 14:31:59 +01:00
parent 4275877fb4
commit a3e3bfac62
5 changed files with 24 additions and 10 deletions

View File

@@ -127,6 +127,7 @@ object OpenGotha {
shortName = genParams.shortName, shortName = genParams.shortName,
startDate = genParams.beginDate.toLocalDate(), startDate = genParams.beginDate.toLocalDate(),
endDate = genParams.endDate.toLocalDate(), endDate = genParams.endDate.toLocalDate(),
director = genParams.director,
country = "fr", // no country in opengotha format country = "fr", // no country in opengotha format
location = genParams.location, location = genParams.location,
online = genParams.isBInternet ?: false, online = genParams.isBInternet ?: false,
@@ -298,7 +299,7 @@ object OpenGotha {
TimeSystem.TimeSystemType.JAPANESE -> "STDBYOYOMI" TimeSystem.TimeSystemType.JAPANESE -> "STDBYOYOMI"
TimeSystem.TimeSystemType.CANADIAN -> "CANBYOYOMI" TimeSystem.TimeSystemType.CANADIAN -> "CANBYOYOMI"
TimeSystem.TimeSystemType.FISCHER -> "FISCHER" 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( displayRank(
if (tournament.pairing is MacMahon) tournament.pairing.mmBar else 8 if (tournament.pairing is MacMahon) tournament.pairing.mmBar else 8
).uppercase(Locale.ROOT) ).uppercase(Locale.ROOT)

View File

@@ -22,6 +22,7 @@ sealed class Tournament <P: Pairable>(
val shortName: String, val shortName: String,
val startDate: LocalDate, val startDate: LocalDate,
val endDate: LocalDate, val endDate: LocalDate,
val director: String,
val country: String, val country: String,
val location: String, val location: String,
val online: Boolean, val online: Boolean,
@@ -128,6 +129,7 @@ class StandardTournament(
shortName: String, shortName: String,
startDate: LocalDate, startDate: LocalDate,
endDate: LocalDate, endDate: LocalDate,
director: String,
country: String, country: String,
location: String, location: String,
online: Boolean, online: Boolean,
@@ -137,7 +139,7 @@ class StandardTournament(
rules: Rules = Rules.FRENCH, rules: Rules = Rules.FRENCH,
gobanSize: Int = 19, gobanSize: Int = 19,
komi: Double = 7.5 komi: Double = 7.5
): Tournament<Player>(id, type, name, shortName, startDate, endDate, country, location, online, timeSystem, rounds, pairing, rules, gobanSize, komi) { ): Tournament<Player>(id, type, name, shortName, startDate, endDate, director, country, location, online, timeSystem, rounds, pairing, rules, gobanSize, komi) {
override val players get() = _pairables override val players get() = _pairables
} }
@@ -149,6 +151,7 @@ class TeamTournament(
shortName: String, shortName: String,
startDate: LocalDate, startDate: LocalDate,
endDate: LocalDate, endDate: LocalDate,
director: String,
country: String, country: String,
location: String, location: String,
online: Boolean, online: Boolean,
@@ -158,7 +161,7 @@ class TeamTournament(
rules: Rules = Rules.FRENCH, rules: Rules = Rules.FRENCH,
gobanSize: Int = 19, gobanSize: Int = 19,
komi: Double = 7.5 komi: Double = 7.5
): Tournament<TeamTournament.Team>(id, type, name, shortName, startDate, endDate, country, location, online, timeSystem, rounds, pairing, rules, gobanSize, komi) { ): Tournament<TeamTournament.Team>(id, type, name, shortName, startDate, endDate, director, country, location, online, timeSystem, rounds, pairing, rules, gobanSize, komi) {
companion object {} companion object {}
override val players = mutableMapOf<ID, Player>() override val players = mutableMapOf<ID, Player>()
val teams: MutableMap<ID, Team> = _pairables val teams: MutableMap<ID, Team> = _pairables
@@ -207,6 +210,7 @@ fun Tournament.Companion.fromJson(json: Json.Object, default: Tournament<*>? = n
shortName = json.getString("shortName") ?: default?.shortName ?: badRequest("missing shortName"), shortName = json.getString("shortName") ?: default?.shortName ?: badRequest("missing shortName"),
startDate = json.getString("startDate")?.let { LocalDate.parse(it) } ?: default?.startDate ?: badRequest("missing startDate"), 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"), 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 }, country = (json.getString("country") ?: default?.country ?: "fr").let { if (it.isEmpty()) "fr" else it },
location = json.getString("location") ?: default?.location ?: badRequest("missing location"), location = json.getString("location") ?: default?.location ?: badRequest("missing location"),
online = json.getBoolean("online") ?: default?.online ?: false, 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"), shortName = json.getString("shortName") ?: default?.shortName ?: badRequest("missing shortName"),
startDate = json.getString("startDate")?.let { LocalDate.parse(it) } ?: default?.startDate ?: badRequest("missing startDate"), 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"), 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"), country = json.getString("country") ?: default?.country ?: badRequest("missing country"),
location = json.getString("location") ?: default?.location ?: badRequest("missing location"), location = json.getString("location") ?: default?.location ?: badRequest("missing location"),
online = json.getBoolean("online") ?: default?.online ?: false, online = json.getBoolean("online") ?: default?.online ?: false,
@@ -258,6 +263,7 @@ fun Tournament<*>.toJson() = Json.Object(
"shortName" to shortName, "shortName" to shortName,
"startDate" to startDate.toString(), "startDate" to startDate.toString(),
"endDate" to endDate.toString(), "endDate" to endDate.toString(),
"director" to director,
"country" to country, "country" to country,
"location" to location, "location" to location,
"online" to online, "online" to online,

View File

@@ -32,6 +32,7 @@ Crit Crit
Ctr Pays Ctr Pays
Dates Dates Dates Dates
Delete Supprimer Delete Supprimer
Director Directeur
Download Télécharger Download Télécharger
Download the standalone web interface module which suits your need, then follow Télécharger le module dinterface web qui correspond à vos besoins, puis suivez Download the standalone web interface module which suits your need, then follow Télécharger le module dinterface web qui correspond à vos besoins, puis suivez
Edit Éditer Edit Éditer

View File

@@ -160,6 +160,7 @@ onLoad(() => {
shortName: form.val('shortName'), shortName: form.val('shortName'),
startDate: parseDate(form.val('startDate')), startDate: parseDate(form.val('startDate')),
endDate: parseDate(form.val('endDate')), endDate: parseDate(form.val('endDate')),
director: form.val('director'),
type: form.val('type'), type: form.val('type'),
rounds: form.val('rounds'), rounds: form.val('rounds'),
country: form.val('country'), country: form.val('country'),

View File

@@ -14,7 +14,7 @@
</div> </div>
</div> </div>
<div class="fields"> <div class="fields">
<div class="ten wide field"> <div class="eight wide field">
<label>Dates</label> <label>Dates</label>
<span id="date-range"> <span id="date-range">
from from
@@ -25,6 +25,11 @@
<input type="text" name="endDate" required class="date" placeholder="end date" #if($tour) value="$tour.endDate" #end/> <input type="text" name="endDate" required class="date" placeholder="end date" #if($tour) value="$tour.endDate" #end/>
</span> </span>
</div> </div>
<div class="eight wide field">
<label>Director</label>
<span class="info"></span>
<input type="text" name="director" placeholder="Tournament director" value="$!tour.director"/>
</div>
</div> </div>
<div class="two stackable fields"> <div class="two stackable fields">
<div class="seven wide field"> <div class="seven wide field">