Fix .tou format
This commit is contained in:
@@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletResponse
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import org.jeudego.pairgoth.model.TimeSystem.TimeSystemType.*
|
||||
import org.jeudego.pairgoth.server.WebappManager
|
||||
import java.io.OutputStreamWriter
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.text.DecimalFormat
|
||||
@@ -173,6 +174,7 @@ ${
|
||||
}
|
||||
|
||||
private fun exportToFFGFormat(tournament: Tournament<*>, lines: List<Json.Object>, writer: PrintWriter) {
|
||||
val version = WebappManager.properties.getProperty("version")!!
|
||||
val ret =
|
||||
""";name=${tournament.shortName}
|
||||
;date=${frDate.format(tournament.startDate)}
|
||||
@@ -183,6 +185,15 @@ ${
|
||||
;ta=${tournament.timeSystem.adjustedTime() / 60}
|
||||
;size=${tournament.gobanSize}
|
||||
;komi=${tournament.komi}
|
||||
; Generated by Pairgoth $version
|
||||
; ${
|
||||
when (tournament.timeSystem.type) {
|
||||
CANADIAN -> "Canadian ${tournament.timeSystem.mainTime / 60} minutes, ${tournament.timeSystem.stones} stones / ${tournament.timeSystem.byoyomi / 60} minutes"
|
||||
JAPANESE -> "Japanese ${tournament.timeSystem.mainTime / 60} minutes, ${tournament.timeSystem.periods} periods of ${tournament.timeSystem.byoyomi / 60} minutes"
|
||||
FISCHER -> "Fisher ${tournament.timeSystem.mainTime / 60} minutes + ${tournament.timeSystem.increment} seconds${ if (tournament.timeSystem.maxTime > 0) ", max ${tournament.timeSystem.maxTime / 60} minutes" else "" }"
|
||||
SUDDEN_DEATH -> "Sudden death ${tournament.timeSystem.mainTime / 60} minutes"
|
||||
}
|
||||
}
|
||||
;
|
||||
;Num Nom Prenom Niv Licence Club
|
||||
${
|
||||
@@ -195,11 +206,14 @@ ${
|
||||
displayRank(player.getInt("rank")!!).uppercase().padStart(3, ' ')
|
||||
} ${
|
||||
player.getString("ffg") ?: " "
|
||||
} ${
|
||||
(player.getString("club") ?: "").padStart(6).take(6)
|
||||
} ${
|
||||
if (player.getString("country") == "FR")
|
||||
(player.getString("club") ?: "").padEnd(4).take(4)
|
||||
else
|
||||
(player.getString("country") ?: "").padEnd(4).take(4)
|
||||
} ${
|
||||
player.getArray("results")!!.joinToString(" ") {
|
||||
(it as String).replace("/", "").replace(Regex("(?<=[bw])$"), "0").padStart(7, ' ')
|
||||
(it as String).replace(Regex("(?<=[bw])$"), "0").replace("0=", "0= ").padStart(7, ' ')
|
||||
}
|
||||
}"
|
||||
}
|
||||
|
Reference in New Issue
Block a user