diff --git a/backend/src/main/java/core/api/models/timemanager/tasks/TaskEntityInfo.java b/backend/src/main/java/core/api/models/timemanager/tasks/TaskEntityInfo.java index 1d271c3..4785251 100644 --- a/backend/src/main/java/core/api/models/timemanager/tasks/TaskEntityInfo.java +++ b/backend/src/main/java/core/api/models/timemanager/tasks/TaskEntityInfo.java @@ -24,6 +24,8 @@ public class TaskEntityInfo { private boolean finishable; + private boolean hasActiveSchedules; + public TaskEntityInfo(Task task) { this.taskID = task.getTaskID(); this.taskName = task.getTaskName(); @@ -36,6 +38,7 @@ public class TaskEntityInfo { this.finished = task.isFinished(); this.workTime = task.getWorkTime(); this.finishable = task.isFinishable(); + this.hasActiveSchedules = task.hasActiveSchedule(); } public long getTaskID() { @@ -109,4 +112,12 @@ public class TaskEntityInfo { public void setFinishable(boolean finishable) { this.finishable = finishable; } + + public boolean isHasActiveSchedules() { + return hasActiveSchedules; + } + + public void setHasActiveSchedules(boolean hasActiveSchedules) { + this.hasActiveSchedules = hasActiveSchedules; + } } diff --git a/frontend/src/api/model/taskEntityInfo.ts b/frontend/src/api/model/taskEntityInfo.ts index cfc6022..6948125 100644 --- a/frontend/src/api/model/taskEntityInfo.ts +++ b/frontend/src/api/model/taskEntityInfo.ts @@ -48,5 +48,9 @@ export interface TaskEntityInfo { * determines whether the task can be finished */ finishable: boolean; + /** + * determines whether the task has active schedules + */ + hasActiveSchedules: boolean; } diff --git a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.html b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.html index 0fc9f75..1a7294c 100644 --- a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.html +++ b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.html @@ -35,7 +35,7 @@ Status -
+

{{getStatusOfTask(task)}}

diff --git a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.ts b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.ts index 57357f7..b4cb10f 100644 --- a/frontend/src/app/tasks/task-dashboard/task-dashboard.component.ts +++ b/frontend/src/app/tasks/task-dashboard/task-dashboard.component.ts @@ -8,6 +8,7 @@ import {TaskEditorData} from "../task-editor/TaskEditorData"; import {MatDialog} from "@angular/material/dialog"; import {MatSnackBar} from "@angular/material/snack-bar"; import {ClearTaskDialogComponent, ClearTaskDialogData} from "../clear-task-dialog/clear-task-dialog.component"; +import * as moment from "moment/moment"; @Component({ selector: 'app-task-dashboard', @@ -52,7 +53,13 @@ export class TaskDashboardComponent implements OnChanges{ } getStatusOfTask(task: TaskEntityInfo) { - return "green"; + if(moment(task.deadline, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isBefore(moment())) { + return "🔴"; + } else if(task.finishable){ + return "🟠"; + } else { + return "🟢"; + } } deleteTask(deletedTask: TaskEntityInfo) { diff --git a/frontend/src/app/tasks/task-editor/TaskEditorData.ts b/frontend/src/app/tasks/task-editor/TaskEditorData.ts index 4f315b8..f1140e2 100644 --- a/frontend/src/app/tasks/task-editor/TaskEditorData.ts +++ b/frontend/src/app/tasks/task-editor/TaskEditorData.ts @@ -1,6 +1,6 @@ -import {TaskEntityInfo} from "../../../api"; +import {TaskEntityInfo, TaskTaskgroupInfo} from "../../../api"; export interface TaskEditorData { taskgroupID: number; - task: TaskEntityInfo | undefined + task: TaskTaskgroupInfo | TaskEntityInfo | undefined } diff --git a/frontend/src/app/tasks/task-editor/task-editor.component.ts b/frontend/src/app/tasks/task-editor/task-editor.component.ts index a79efe4..d6573dd 100644 --- a/frontend/src/app/tasks/task-editor/task-editor.component.ts +++ b/frontend/src/app/tasks/task-editor/task-editor.component.ts @@ -65,7 +65,7 @@ export class TaskEditorComponent implements OnInit { eta: this.etaCtrl.value, startDate: startDate_formatted, deadline: endDate_formatted, - finishable: this.finishable + finishable: this.finishable, }).subscribe({ next: resp => { this.dialog.close(resp); diff --git a/openapi.yaml b/openapi.yaml index a424554..13559c7 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2148,6 +2148,7 @@ components: - finished - workTime - finishable + - hasActiveSchedules additionalProperties: false properties: taskID: @@ -2186,6 +2187,9 @@ components: finishable: type: boolean description: determines whether the task can be finished + hasActiveSchedules: + type: boolean + description: determines whether the task has active schedules TaskTaskgroupInfo: required: - taskID