Fix room constraint

This commit is contained in:
Lars Westermann 2019-06-12 21:08:34 +02:00
parent 07a619f826
commit 5a9fa08e69
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D

View file

@ -251,7 +251,7 @@ fun Route.room() {
+"Gesperrt"
}
input(
name = "constraint-blocked-day-$index",
name = "constraint-room-day-$index",
classes = "form-control"
) {
value = constraint.day.toString()
@ -259,7 +259,7 @@ fun Route.room() {
placeholder = "Tag"
}
input(
name = "constraint-blocked-start-$index",
name = "constraint-room-start-$index",
classes = "form-control"
) {
val time = constraint.start
@ -277,7 +277,7 @@ fun Route.room() {
placeholder = "Start"
}
input(
name = "constraint-blocked-end-$index",
name = "constraint-room-end-$index",
classes = "form-control"
) {
val time = constraint.end
@ -553,7 +553,7 @@ private fun parseConstraintParam(params: Map<String, String?>): List<RoomBlock>
val h = v.substringBefore(":").toIntOrNull()
val m = v.substringAfter(":").toIntOrNull()
val time = if (h != null && m != null) {
val time = if (":" in v && h != null && m != null) {
h * 60 + m
} else {
v.toIntOrNull()
@ -565,7 +565,7 @@ private fun parseConstraintParam(params: Map<String, String?>): List<RoomBlock>
val h = v.substringBefore(":").toIntOrNull()
val m = v.substringAfter(":").toIntOrNull()
val time = if (h != null && m != null) {
val time = if (":" in v && h != null && m != null) {
h * 60 + m
} else {
v.toIntOrNull()