Bugfixes
This commit is contained in:
parent
5a9fa08e69
commit
94803ba805
|
@ -56,6 +56,35 @@ fun Route.account() {
|
|||
+"Aus Wiki importieren"
|
||||
}
|
||||
}
|
||||
|
||||
if (user.checkPermission(Permission.SCHEDULE)) {
|
||||
form(action = "$prefix/account/shift", method = FormMethod.post) {
|
||||
div("form-group") {
|
||||
label {
|
||||
htmlFor = "shift"
|
||||
+"Zeitplan verschieben"
|
||||
}
|
||||
input(
|
||||
name = "shift",
|
||||
classes = "form-control",
|
||||
type = InputType.number
|
||||
) {
|
||||
id = "shift"
|
||||
placeholder = "Tage"
|
||||
value = ""
|
||||
|
||||
min = "-1337"
|
||||
max = "1337"
|
||||
}
|
||||
}
|
||||
|
||||
div("form-group") {
|
||||
button(type = ButtonType.submit, classes = "form-btn btn-primary") {
|
||||
+"Verschieben"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -523,4 +552,21 @@ fun Route.account() {
|
|||
call.error(HttpStatusCode.Unauthorized)
|
||||
}
|
||||
}
|
||||
|
||||
post("/account/shift") {
|
||||
authenticateOrRedirect(Permission.SCHEDULE) {
|
||||
val shift = call.request.queryParameters["shift"]?.toIntOrNull() ?: 0
|
||||
|
||||
if (shift != 0 && shift in -1337..1337) {
|
||||
val schedules = ScheduleRepository.all()
|
||||
|
||||
for (schedule in schedules) {
|
||||
ScheduleRepository.update(schedule.copy(day = schedule.day + shift))
|
||||
}
|
||||
}
|
||||
|
||||
call.respondRedirect("$prefix/account")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -945,7 +945,7 @@ private fun parseConstraintParam(params: Map<String, String?>) = params.map { (k
|
|||
} else {
|
||||
v.toIntOrNull()?.let { WorkGroupConstraint(ConstraintType.OnlyAfterTime, time = it) }
|
||||
}
|
||||
} else null
|
||||
} else v.toIntOrNull()?.let { WorkGroupConstraint(ConstraintType.OnlyAfterTime, time = it) }
|
||||
}
|
||||
}
|
||||
key.startsWith("constraint-only-before-time") -> {
|
||||
|
@ -962,7 +962,7 @@ private fun parseConstraintParam(params: Map<String, String?>) = params.map { (k
|
|||
} else {
|
||||
v.toIntOrNull()?.let { WorkGroupConstraint(ConstraintType.OnlyBeforeTime, time = it) }
|
||||
}
|
||||
} else null
|
||||
} else v.toIntOrNull()?.let { WorkGroupConstraint(ConstraintType.OnlyBeforeTime, time = it) }
|
||||
}
|
||||
}
|
||||
key.startsWith("constraint-exact-time") -> {
|
||||
|
@ -979,7 +979,7 @@ private fun parseConstraintParam(params: Map<String, String?>) = params.map { (k
|
|||
} else {
|
||||
v.toIntOrNull()?.let { WorkGroupConstraint(ConstraintType.ExactTime, time = it) }
|
||||
}
|
||||
} else null
|
||||
} else v.toIntOrNull()?.let { WorkGroupConstraint(ConstraintType.ExactTime, time = it) }
|
||||
}
|
||||
}
|
||||
key.startsWith("constraint-not-at-same-time") -> {
|
||||
|
@ -1015,6 +1015,11 @@ private fun parseConstraintParam(params: Map<String, String?>) = params.map { (k
|
|||
day = c1.day ?: c2.day,
|
||||
time = c1.time ?: c2.time
|
||||
)
|
||||
c1.type == ConstraintType.ExactTime -> WorkGroupConstraint(
|
||||
ConstraintType.ExactTime,
|
||||
day = c1.day ?: c2.day,
|
||||
time = c1.time ?: c2.time
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue