Fix FFG/EGF export format issues

- FFG .tou name field: use AAMMJJ-ville format (2-digit year, hyphen,
  lowercase city without accents), e.g., "250830-marseille"
- EGF .h country code: use uppercase PC[FR,...] instead of PC[fr,...]
- Unify version numbers: use actual version from properties everywhere
  instead of hardcoded "v0.1"
This commit is contained in:
Claude Brisson
2025-11-29 10:51:35 +01:00
parent 667b3e17da
commit 09c8e834f6

View File

@@ -114,7 +114,7 @@ object StandingsHandler: PairgothApiHandler {
"""
; CL[${egfClass}]
; EV[${tournament.name}]
; PC[${tournament.country.lowercase()},${tournament.location}]
; PC[${tournament.country.uppercase()},${tournament.location}]
; DT[${tournament.startDate},${tournament.endDate}]
; HA[${
if (tournament.pairing.type == PairingType.MAC_MAHON) "h${tournament.pairing.pairingParams.handicap.correction}"
@@ -123,7 +123,7 @@ object StandingsHandler: PairgothApiHandler {
}]
; KM[${tournament.komi}]
; TM[${tournament.timeSystem.adjustedTime() / 60}]
; CM[Generated by Pairgoth v0.1]
; CM[Generated by Pairgoth ${WebappManager.properties.getProperty("version")}]
;
; Pl Name Rk Co Club ${ criteria.map { it.name.replace(Regex("(S?)O?(SOS|DOS)[MW]?"), "$1$2").padStart(7, ' ') }.joinToString(" ") }
${
@@ -173,12 +173,13 @@ ${
private fun exportToFFGFormat(tournament: Tournament<*>, lines: List<Json.Object>, writer: PrintWriter) {
val version = WebappManager.properties.getProperty("version")!!
val ffgName = "${ffgDate.format(tournament.startDate)}-${tournament.location.lowercase(Locale.ROOT).sanitizeISO()}"
val ret =
""";name=${tournament.shortName}
""";name=$ffgName
;date=${frDate.format(tournament.startDate)}
;vill=${tournament.location}${if (tournament.online) "(online)" else ""}
;comm=${tournament.name}
;prog=Pairgoth v0.1
;prog=Pairgoth $version
;time=${tournament.timeSystem.mainTime / 60}
;ta=${tournament.timeSystem.adjustedTime() / 60}
;size=${tournament.gobanSize}
@@ -264,4 +265,5 @@ ${
private val numFormat = DecimalFormat("###0.#")
private val frDate: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy")
private val ffgDate: DateTimeFormatter = DateTimeFormatter.ofPattern("yyMMdd")
}