issue-96: Fix TaskStatus #104

Merged
sebastian merged 2 commits from issue-96 into master 2024-03-15 07:22:53 +01:00
Showing only changes of commit 56a7047bad - Show all commits

View File

@ -16,6 +16,7 @@ import {TaskEditorComponent} from "../task-editor/task-editor.component";
import {TaskEditorData} from "../task-editor/TaskEditorData"; import {TaskEditorData} from "../task-editor/TaskEditorData";
import * as moment from "moment"; import * as moment from "moment";
import {ScheduleDashboardComponent} from "../../schedules/schedule-dashboard/schedule-dashboard.component"; import {ScheduleDashboardComponent} from "../../schedules/schedule-dashboard/schedule-dashboard.component";
import {TaskStatusService} from "../task-status.service";
@Component({ @Component({
selector: 'app-task-detail-overview', selector: 'app-task-detail-overview',
@ -53,7 +54,8 @@ export class TaskDetailOverviewComponent implements OnInit {
private taskService: TaskService, private taskService: TaskService,
private dialog: MatDialog, private dialog: MatDialog,
private scheduleService: ScheduleService, private scheduleService: ScheduleService,
private router: Router) { private router: Router,
private taskStatusService: TaskStatusService) {
} }
ngOnInit(): void { ngOnInit(): void {
@ -102,13 +104,8 @@ export class TaskDetailOverviewComponent implements OnInit {
} }
getStatusOfTask(task: TaskEntityInfo ) { getStatusOfTask(task: TaskEntityInfo ) {
if(moment(task.deadline, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isBefore(moment())) { const taskStatus = this.taskStatusService.computeTaskStatus(task);
return "🔴"; return this.taskStatusService.convertTaskStatusToColor(taskStatus);
} else if(this.schedules.length == 0 && this.schedulesLoaded){
return "🟠";
} else {
return "🟢";
}
} }
calcProgress() { calcProgress() {