Add wall start number
This commit is contained in:
parent
ea3324abed
commit
6d243f2903
|
@ -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"
|
||||
|
|
|
@ -12,8 +12,6 @@ data class Track(
|
|||
override val updateAt: Long = 0
|
||||
) : Model {
|
||||
|
||||
|
||||
|
||||
override fun createSearch() = SearchElement(
|
||||
mapOf(
|
||||
"name" to name
|
||||
|
|
|
@ -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") {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -14,6 +14,7 @@ announcement = "data/announcement.txt"
|
|||
[schedule]
|
||||
reference = "1970-01-01"
|
||||
offset = 0
|
||||
wall_start = 0
|
||||
|
||||
[security]
|
||||
session_name = "SESSION"
|
||||
|
|
Loading…
Reference in a new issue