Take subtasks in Dashboard into account (TaskOverview)
All checks were successful
Java CI with Maven / build-and-push-frontend (push) Successful in 8s
Java CI with Maven / build-and-push-backend (push) Successful in 8s

This commit is contained in:
Sebastian Böckelmann 2024-03-16 14:18:23 +01:00
parent 8487a573a1
commit dfe12e6102
6 changed files with 33 additions and 1 deletions

View File

@ -18,6 +18,7 @@ public class TaskOverviewInfo {
private boolean overdue; private boolean overdue;
private boolean finishable; private boolean finishable;
private boolean hasSubtasks;
public TaskOverviewInfo(Task task) { public TaskOverviewInfo(Task task) {
this.taskID = task.getTaskID(); this.taskID = task.getTaskID();
@ -33,6 +34,7 @@ public class TaskOverviewInfo {
this.overdue = LocalDate.now().isAfter(task.getDeadline()); this.overdue = LocalDate.now().isAfter(task.getDeadline());
} }
this.finishable = task.isFinishable(); this.finishable = task.isFinishable();
this.hasSubtasks = !task.getSubtasks().isEmpty();
} }
public long getTaskID() { public long getTaskID() {
@ -90,4 +92,12 @@ public class TaskOverviewInfo {
public void setFinishable(boolean finishable) { public void setFinishable(boolean finishable) {
this.finishable = finishable; this.finishable = finishable;
} }
public boolean isHasSubtasks() {
return hasSubtasks;
}
public void setHasSubtasks(boolean hasSubtasks) {
this.hasSubtasks = hasSubtasks;
}
} }

View File

@ -42,5 +42,9 @@ export interface TaskOverviewInfo {
* determines whether the task can be finished * determines whether the task can be finished
*/ */
finishable: boolean; finishable: boolean;
/**
* determines whether the task has subtasks
*/
hasSubtasks: boolean;
} }

View File

@ -31,3 +31,13 @@
text-decoration: none; text-decoration: none;
color: black; color: black;
} }
.task-title {
display: flex;
justify-content: space-between;
}
.subtask-link {
color: #00bc8c;
text-decoration: none;
}

View File

@ -2,7 +2,10 @@
<button mat-raised-button class="greenBtn long-btn"(click)="openTaskCreation()">Add</button> <button mat-raised-button class="greenBtn long-btn"(click)="openTaskCreation()">Add</button>
<mat-card *ngFor="let task of tasks"> <mat-card *ngFor="let task of tasks">
<mat-card-content> <mat-card-content>
<h3><a class="task-link" [routerLink]="['/taskgroups', taskgroupID!, 'tasks', task.taskID]">{{task.taskName}}</a></h3> <h3 class="task-title">
<a class="task-link" [routerLink]="['/taskgroups', taskgroupID!, 'tasks', task.taskID]">{{task.taskName}}</a>
<button mat-button class="subtask-link" *ngIf="task.hasSubtasks" [routerLink]="['/taskgroups', taskgroupID!, 'tasks', task.taskID]">has Subtasks</button>
</h3>
<mat-progress-bar mode="determinate" value="{{task.activeTime}}" class="progress"></mat-progress-bar> <mat-progress-bar mode="determinate" value="{{task.activeTime}}" class="progress"></mat-progress-bar>
<p class="task-info"><i>ETA: </i>{{task.activeTime}} / {{task.eta}}</p> <p class="task-info"><i>ETA: </i>{{task.activeTime}} / {{task.eta}}</p>
<p class="task-info"><i>Limit: </i>{{task.limit}}</p> <p class="task-info"><i>Limit: </i>{{task.limit}}</p>

View File

@ -89,6 +89,7 @@ export class TaskOverviewComponent {
activeTime: 0, activeTime: 0,
overdue: res.overdue, overdue: res.overdue,
taskgroupPath: [], taskgroupPath: [],
hasSubtasks: false,
finishable: res.finishable finishable: res.finishable
} }
this.creationEmitter.emit({ this.creationEmitter.emit({

View File

@ -2807,6 +2807,7 @@ components:
- overdue - overdue
- taskgroupPath - taskgroupPath
- finishable - finishable
- hasSubtasks
additionalProperties: false additionalProperties: false
properties: properties:
taskID: taskID:
@ -2841,6 +2842,9 @@ components:
finishable: finishable:
type: boolean type: boolean
description: determines whether the task can be finished description: determines whether the task can be finished
hasSubtasks:
type: boolean
description: determines whether the task has subtasks
ScheduleStatus: ScheduleStatus:
required: required:
- activeMinutes - activeMinutes