diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/TimeSystem.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/TimeSystem.kt index 04960f7..3819014 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/TimeSystem.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/TimeSystem.kt @@ -8,7 +8,7 @@ data class TimeSystem( val type: TimeSystemType, val mainTime: Int, val increment: Int, - val maxTime: Int = -1, + val maxTime: Int = 0, val byoyomi: Int, val periods: Int, val stones: Int @@ -37,7 +37,7 @@ fun StandardByoyomi(mainTime: Int, byoyomi: Int, periods: Int) = stones = 1 ) -fun FischerTime(mainTime: Int, increment: Int, maxTime: Int = -1) = +fun FischerTime(mainTime: Int, increment: Int, maxTime: Int = 0) = TimeSystem( type = FISCHER, mainTime = mainTime, @@ -75,7 +75,7 @@ fun TimeSystem.Companion.fromJson(json: Json.Object) = "FISCHER" -> FischerTime( mainTime = json.getInt("mainTime") ?: badRequest("missing timeSystem mainTime"), increment = json.getInt("increment") ?: badRequest("missing timeSystem increment"), - maxTime = json.getInt("maxTime")?.let { if (it == Int.MAX_VALUE) -1 else it } ?: -1 + maxTime = json.getInt("maxTime")?.let { if (it == Int.MAX_VALUE || it == -1) 0 else it } ?: 0 ) "SUDDEN_DEATH" -> SuddenDeath( mainTime = json.getInt("mainTime") ?: badRequest("missing timeSystem mainTime"), @@ -87,7 +87,7 @@ fun TimeSystem.toJson() = when (type) { TimeSystem.TimeSystemType.CANADIAN -> Json.Object("type" to type.name, "mainTime" to mainTime, "byoyomi" to byoyomi, "stones" to stones) TimeSystem.TimeSystemType.JAPANESE -> Json.Object("type" to type.name, "mainTime" to mainTime, "byoyomi" to byoyomi, "periods" to periods) TimeSystem.TimeSystemType.FISCHER -> - if (maxTime == Int.MAX_VALUE || maxTime == -1) Json.Object("type" to type.name, "mainTime" to mainTime, "increment" to increment) + if (maxTime == Int.MAX_VALUE || maxTime == -1 || maxTime == 0) Json.Object("type" to type.name, "mainTime" to mainTime, "increment" to increment) else Json.Object("type" to type.name, "mainTime" to mainTime, "increment" to increment, "maxTime" to maxTime) TimeSystem.TimeSystemType.SUDDEN_DEATH -> Json.Object("type" to type.name, "mainTime" to mainTime) } diff --git a/view-webapp/src/main/webapp/tour-information.inc.html b/view-webapp/src/main/webapp/tour-information.inc.html index 5460dae..cc86835 100644 --- a/view-webapp/src/main/webapp/tour-information.inc.html +++ b/view-webapp/src/main/webapp/tour-information.inc.html @@ -189,7 +189,7 @@
- +
diff --git a/view-webapp/src/main/webapp/tour.html b/view-webapp/src/main/webapp/tour.html index f05ba11..7da319e 100644 --- a/view-webapp/src/main/webapp/tour.html +++ b/view-webapp/src/main/webapp/tour.html @@ -73,10 +73,8 @@ if (value && /\d+:\d+:\d+/.test(value)) { let parts = value.split(':'); let seconds = parts[0] * 3600 + parts[1] * 60 + parts[2] * 1; - console.log(`${value} => ${seconds}`); return seconds; } - console.log(`invalid hh:mm:ss value: ${value}`); return 0; } function chooseStep(step) {