Add wall start number

This commit is contained in:
Lars Westermann 2019-06-12 13:03:24 +02:00
parent ea3324abed
commit 6d243f2903
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D
5 changed files with 13 additions and 6 deletions

View file

@ -5,8 +5,9 @@ prefix = "/plan"
debug = false debug = false
[schedule] [schedule]
reference = "2019-06-10" reference = "2019-06-12"
offset = 7200000 offset = 7200000
wall_start = 1
[general] [general]
wiki_url = "https://wiki.kif.rocks/w/index.php?title=KIF470:Arbeitskreise&action=raw" wiki_url = "https://wiki.kif.rocks/w/index.php?title=KIF470:Arbeitskreise&action=raw"

View file

@ -12,8 +12,6 @@ data class Track(
override val updateAt: Long = 0 override val updateAt: Long = 0
) : Model { ) : Model {
override fun createSearch() = SearchElement( override fun createSearch() = SearchElement(
mapOf( mapOf(
"name" to name "name" to name

View file

@ -65,6 +65,7 @@ object Configuration {
private object ScheduleSpec : ConfigSpec("schedule") { private object ScheduleSpec : ConfigSpec("schedule") {
val reference by required<String>() val reference by required<String>()
val offset by required<Long>() val offset by required<Long>()
val wallStart by required<Int>("wall_start")
} }
object Schedule { object Schedule {
@ -76,6 +77,7 @@ object Configuration {
} }
val offset by c(ScheduleSpec.offset) val offset by c(ScheduleSpec.offset)
val wallStart by c(ScheduleSpec.wallStart)
} }
private object SecuritySpec : ConfigSpec("security") { private object SecuritySpec : ConfigSpec("security") {

View file

@ -57,10 +57,15 @@ suspend fun genWallData(day: Int): WallData {
fun Route.wall() { fun Route.wall() {
get("/wand") { 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 var min = days.mapNotNull { it.min }.min() ?: 12 * 60
val max = days.map { it.max }.filterNotNull().max() ?: 12 * 60 val max = days.mapNotNull { it.max }.max() ?: 12 * 60
if (min > max) { if (min > max) {
min = max min = max

View file

@ -14,6 +14,7 @@ announcement = "data/announcement.txt"
[schedule] [schedule]
reference = "1970-01-01" reference = "1970-01-01"
offset = 0 offset = 0
wall_start = 0
[security] [security]
session_name = "SESSION" session_name = "SESSION"