mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Fix granting extra time for another day after task completion
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
@@ -24,11 +24,13 @@ export class ReviewChildTaskAction extends ParentAction {
|
||||
readonly taskId: string
|
||||
readonly ok: boolean
|
||||
readonly time: number
|
||||
readonly day?: number
|
||||
|
||||
constructor ({ taskId, ok, time }: {
|
||||
constructor ({ taskId, ok, time, day }: {
|
||||
taskId: string
|
||||
ok: boolean
|
||||
time: number
|
||||
day?: number
|
||||
}) {
|
||||
super()
|
||||
|
||||
@@ -39,13 +41,22 @@ export class ReviewChildTaskAction extends ParentAction {
|
||||
throwOutOfRange({ actionType, field: 'time', value: time })
|
||||
}
|
||||
|
||||
if (day !== undefined) {
|
||||
assertSafeInteger({ actionType, field: 'day', value: day })
|
||||
|
||||
if (day < 0) {
|
||||
throwOutOfRange({ actionType, field: 'day', value: day })
|
||||
}
|
||||
}
|
||||
|
||||
this.taskId = taskId
|
||||
this.ok = ok
|
||||
this.time = time
|
||||
this.day = day
|
||||
}
|
||||
|
||||
static parse = ({ taskId, ok, time }: SerializedReviewChildTaskAction) => (
|
||||
new ReviewChildTaskAction({ taskId, ok, time })
|
||||
static parse = ({ taskId, ok, time, day }: SerializedReviewChildTaskAction) => (
|
||||
new ReviewChildTaskAction({ taskId, ok, time, day })
|
||||
)
|
||||
}
|
||||
|
||||
@@ -54,4 +65,5 @@ export interface SerializedReviewChildTaskAction {
|
||||
taskId: string
|
||||
ok: boolean
|
||||
time: number
|
||||
day?: number
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user