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
[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"

View file

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

View file

@ -65,6 +65,7 @@ object Configuration {
private object ScheduleSpec : ConfigSpec("schedule") {
val reference by required<String>()
val offset by required<Long>()
val wallStart by required<Int>("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") {

View file

@ -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

View file

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