issue-25 #27

Merged
sebastian merged 32 commits from issue-25 into issue-18 2023-10-28 19:33:06 +02:00
8 changed files with 77 additions and 9 deletions
Showing only changes of commit 2c6c5dd6a6 - Show all commits

View File

@ -5,10 +5,9 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Remove update spamming in console"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Remove update spamming in console">
<change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskgroup/RecursiveTaskgroupInfo.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskOverviewInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/controller/TaskgroupController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/TaskgroupController.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskgroup/RecursiveTaskgroupInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskgroup/RecursiveTaskgroupInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Taskgroup.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Taskgroup.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -104,7 +103,7 @@
<workItem from="1698246651541" duration="5106000" /> <workItem from="1698246651541" duration="5106000" />
<workItem from="1698298897364" duration="4242000" /> <workItem from="1698298897364" duration="4242000" />
<workItem from="1698426430946" duration="665000" /> <workItem from="1698426430946" duration="665000" />
<workItem from="1698474363766" duration="1934000" /> <workItem from="1698474363766" duration="3686000" />
</task> </task>
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies"> <task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
<option name="closed" value="true" /> <option name="closed" value="true" />

View File

@ -4,7 +4,9 @@ import core.api.models.timemanager.tasks.TaskOverviewInfo;
import core.entities.timemanager.Task; import core.entities.timemanager.Task;
import core.entities.timemanager.Taskgroup; import core.entities.timemanager.Taskgroup;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List; import java.util.List;
public class RecursiveTaskgroupInfo { public class RecursiveTaskgroupInfo {
@ -12,9 +14,13 @@ public class RecursiveTaskgroupInfo {
private long taskgroupID; private long taskgroupID;
private String taskgroupName; private String taskgroupName;
private boolean hasOverdueTask;
private int amountActiveTasks;
private List<RecursiveTaskgroupInfo> childTaskgroups = new ArrayList<>(); private List<RecursiveTaskgroupInfo> childTaskgroups = new ArrayList<>();
private List<TaskOverviewInfo> activeTasks = new ArrayList<>(); private List<TaskOverviewInfo> activeTasks = new LinkedList<>();
public RecursiveTaskgroupInfo(Taskgroup taskgroup) { public RecursiveTaskgroupInfo(Taskgroup taskgroup) {
this.taskgroupID = taskgroup.getTaskgroupID(); this.taskgroupID = taskgroup.getTaskgroupID();
@ -24,9 +30,13 @@ public class RecursiveTaskgroupInfo {
this.childTaskgroups.add(new RecursiveTaskgroupInfo(child)); this.childTaskgroups.add(new RecursiveTaskgroupInfo(child));
} }
for(Task task : taskgroup.getTasks()) { for(Task task : taskgroup.getActiveTasks()) {
this.activeTasks.add(new TaskOverviewInfo(task)); this.activeTasks.add(new TaskOverviewInfo(task));
if(task.getDeadline().isBefore(LocalDate.now())) {
this.hasOverdueTask = true;
}
} }
this.amountActiveTasks = taskgroup.getAmountOfActiveTasks();
} }
public long getTaskgroupID() { public long getTaskgroupID() {
@ -60,4 +70,20 @@ public class RecursiveTaskgroupInfo {
public void setActiveTasks(List<TaskOverviewInfo> activeTasks) { public void setActiveTasks(List<TaskOverviewInfo> activeTasks) {
this.activeTasks = activeTasks; this.activeTasks = activeTasks;
} }
public boolean isHasOverdueTask() {
return hasOverdueTask;
}
public void setHasOverdueTask(boolean hasOverdueTask) {
this.hasOverdueTask = hasOverdueTask;
}
public int getAmountActiveTasks() {
return amountActiveTasks;
}
public void setAmountActiveTasks(int amountActiveTasks) {
this.amountActiveTasks = amountActiveTasks;
}
} }

View File

@ -97,4 +97,22 @@ public class Taskgroup {
} }
return ancestors; return ancestors;
} }
public List<Task> getActiveTasks() {
List<Task> tasks = new LinkedList<>();
for(Task task : this.tasks) {
if(!task.isFinished()) {
tasks.add(task);
}
}
return tasks;
}
public int getAmountOfActiveTasks() {
int activeAmountTasks = getActiveTasks().size();
for(Taskgroup taskgroup : children) {
activeAmountTasks += taskgroup.getAmountOfActiveTasks();
}
return activeAmountTasks;
}
} }

View File

@ -23,5 +23,13 @@ export interface RecursiveTaskgroupInfo {
taskgroupName: string; taskgroupName: string;
childTaskgroups: Array<RecursiveTaskgroupInfo>; childTaskgroups: Array<RecursiveTaskgroupInfo>;
activeTasks: Array<TaskOverviewInfo>; activeTasks: Array<TaskOverviewInfo>;
/**
* determines whether the taskgroup has an overdue task or not
*/
hasOverdueTask: boolean;
/**
* determines the number of active tasks that can be scheduled
*/
amountActiveTasks: number;
} }

View File

@ -161,3 +161,7 @@
align-items: center; align-items: center;
width: 100%; width: 100%;
} }
.overdue-taskgroup {
background-color: #ff6354;
}

View File

@ -3,7 +3,7 @@
</mat-action-list> </mat-action-list>
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl" > <mat-tree [dataSource]="dataSource" [treeControl]="treeControl" >
<!-- This is the tree node template for leaf nodes --> <!-- This is the tree node template for leaf nodes -->
<mat-tree-node *matTreeNodeDef="let node" matTreeNodePadding class="taskgroup-btn" matTreeNodePaddingIndent="10"> <mat-tree-node *matTreeNodeDef="let node" matTreeNodePadding class="taskgroup-btn" matTreeNodePaddingIndent="10" [ngClass]="node.hasOverdueTask? 'overdue-taskgroup':''">
<!-- use a disabled button to provide padding for tree leaf --> <!-- use a disabled button to provide padding for tree leaf -->
<button mat-icon-button disabled></button> <button mat-icon-button disabled></button>
<div class="treenode-content-container"> <div class="treenode-content-container">
@ -13,7 +13,7 @@
</div> </div>
</mat-tree-node> </mat-tree-node>
<!-- This is the tree node template for expandable nodes --> <!-- This is the tree node template for expandable nodes -->
<mat-tree-node *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding class="taskgroup-btn" matTreeNodePaddingIndent="10"> <mat-tree-node *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding class="taskgroup-btn" matTreeNodePaddingIndent="10" [ngClass]="node.hasOverdueTask? 'overdue-taskgroup':''">
<button mat-icon-button matTreeNodeToggle <button mat-icon-button matTreeNodeToggle
[attr.aria-label]="'Toggle ' + node.name" style="padding-left: 10px"> [attr.aria-label]="'Toggle ' + node.name" style="padding-left: 10px">
<mat-icon class="mat-icon-rtl-mirror"> <mat-icon class="mat-icon-rtl-mirror">
@ -24,6 +24,7 @@
<button mat-button class="node-name">{{node.name}}</button> <button mat-button class="node-name">{{node.name}}</button>
<span class="spacer"></span> <span class="spacer"></span>
<div class="task-number">{{node.activeTasks}}</div> <div class="task-number">{{node.activeTasks}}</div>
</div> </div>
</mat-tree-node> </mat-tree-node>
</mat-tree> </mat-tree>

View File

@ -14,6 +14,7 @@ interface ExampleFlatNode {
name: string; name: string;
level: number; level: number;
activeTasks: number; activeTasks: number;
hasOverdueTask: boolean
} }
@Component({ @Component({
selector: 'app-taskgroup-overview', selector: 'app-taskgroup-overview',
@ -26,7 +27,8 @@ export class TaskgroupOverviewComponent {
expandable: !!node.childTaskgroups && node.childTaskgroups.length > 0, expandable: !!node.childTaskgroups && node.childTaskgroups.length > 0,
name: node.taskgroupName, name: node.taskgroupName,
level: level, level: level,
activeTasks: node.activeTasks.length activeTasks: node.amountActiveTasks,
hasOverdueTask: node.hasOverdueTask
}; };
}; };

View File

@ -2002,6 +2002,8 @@ components:
- taskgroupName - taskgroupName
- childTaskgroups - childTaskgroups
- activeTasks - activeTasks
- hasOverdueTask
- amountActiveTasks
additionalProperties: false additionalProperties: false
properties: properties:
taskgroupID: taskgroupID:
@ -2022,6 +2024,14 @@ components:
type: array type: array
items: items:
$ref: '#/components/schemas/TaskOverviewInfo' $ref: '#/components/schemas/TaskOverviewInfo'
hasOverdueTask:
type: boolean
example: true
description: determines whether the taskgroup has an overdue task or not
amountActiveTasks:
type: number
example: 2
description: determines the number of active tasks that can be scheduled
TaskOverviewInfo: TaskOverviewInfo:
required: required:
- taskID - taskID