Bugfixes
This commit is contained in:
parent
94803ba805
commit
06e73365a9
|
@ -56,35 +56,6 @@ 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -552,21 +523,4 @@ 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")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue