From 6d243f29035322c70f1f2a3423f90ec67785489c Mon Sep 17 00:00:00 2001 From: Lars Westermann Date: Wed, 12 Jun 2019 13:03:24 +0200 Subject: [PATCH] Add wall start number --- portal.toml | 3 ++- src/commonMain/kotlin/de/kif/common/model/Track.kt | 2 -- src/jvmMain/kotlin/de/kif/backend/Configuration.kt | 2 ++ src/jvmMain/kotlin/de/kif/backend/route/Wall.kt | 11 ++++++++--- src/jvmMain/resources/portal.toml | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/portal.toml b/portal.toml index 0f51a59..b19f50c 100644 --- a/portal.toml +++ b/portal.toml @@ -5,8 +5,9 @@ prefix = "/plan" debug = false [schedule] -reference = "2019-06-10" +reference = "2019-06-12" offset = 7200000 +wall_start = 1 [general] wiki_url = "https://wiki.kif.rocks/w/index.php?title=KIF470:Arbeitskreise&action=raw" diff --git a/src/commonMain/kotlin/de/kif/common/model/Track.kt b/src/commonMain/kotlin/de/kif/common/model/Track.kt index e4a4a3b..89eb507 100644 --- a/src/commonMain/kotlin/de/kif/common/model/Track.kt +++ b/src/commonMain/kotlin/de/kif/common/model/Track.kt @@ -12,8 +12,6 @@ data class Track( override val updateAt: Long = 0 ) : Model { - - override fun createSearch() = SearchElement( mapOf( "name" to name diff --git a/src/jvmMain/kotlin/de/kif/backend/Configuration.kt b/src/jvmMain/kotlin/de/kif/backend/Configuration.kt index eb7d7e3..31943fe 100644 --- a/src/jvmMain/kotlin/de/kif/backend/Configuration.kt +++ b/src/jvmMain/kotlin/de/kif/backend/Configuration.kt @@ -65,6 +65,7 @@ object Configuration { private object ScheduleSpec : ConfigSpec("schedule") { val reference by required() val offset by required() + val wallStart by required("wall_start") } object Schedule { @@ -76,6 +77,7 @@ object Configuration { } val offset by c(ScheduleSpec.offset) + val wallStart by c(ScheduleSpec.wallStart) } private object SecuritySpec : ConfigSpec("security") { diff --git a/src/jvmMain/kotlin/de/kif/backend/route/Wall.kt b/src/jvmMain/kotlin/de/kif/backend/route/Wall.kt index 7c51b09..70d46ba 100644 --- a/src/jvmMain/kotlin/de/kif/backend/route/Wall.kt +++ b/src/jvmMain/kotlin/de/kif/backend/route/Wall.kt @@ -57,10 +57,15 @@ suspend fun genWallData(day: Int): WallData { fun Route.wall() { get("/wand") { - val days = (0..2).map { genWallData(it) } + val wallStart = Configuration.Schedule.wallStart + val days = listOf( + wallStart, + wallStart + 1, + wallStart + 2 + ).map { genWallData(it) } - var min = days.map { it.min }.filterNotNull().min() ?: 12 * 60 - val max = days.map { it.max }.filterNotNull().max() ?: 12 * 60 + var min = days.mapNotNull { it.min }.min() ?: 12 * 60 + val max = days.mapNotNull { it.max }.max() ?: 12 * 60 if (min > max) { min = max diff --git a/src/jvmMain/resources/portal.toml b/src/jvmMain/resources/portal.toml index 28f8096..4b271c7 100644 --- a/src/jvmMain/resources/portal.toml +++ b/src/jvmMain/resources/portal.toml @@ -14,6 +14,7 @@ announcement = "data/announcement.txt" [schedule] reference = "1970-01-01" offset = 0 +wall_start = 0 [security] session_name = "SESSION"