issue-18 #28
@ -5,10 +5,9 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<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$/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>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -104,7 +103,7 @@
|
||||
<workItem from="1698246651541" duration="5106000" />
|
||||
<workItem from="1698298897364" duration="4242000" />
|
||||
<workItem from="1698426430946" duration="665000" />
|
||||
<workItem from="1698474363766" duration="1934000" />
|
||||
<workItem from="1698474363766" duration="3686000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
|
||||
<option name="closed" value="true" />
|
||||
|
@ -4,7 +4,9 @@ import core.api.models.timemanager.tasks.TaskOverviewInfo;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecursiveTaskgroupInfo {
|
||||
@ -12,9 +14,13 @@ public class RecursiveTaskgroupInfo {
|
||||
private long taskgroupID;
|
||||
private String taskgroupName;
|
||||
|
||||
private boolean hasOverdueTask;
|
||||
|
||||
private int amountActiveTasks;
|
||||
|
||||
private List<RecursiveTaskgroupInfo> childTaskgroups = new ArrayList<>();
|
||||
|
||||
private List<TaskOverviewInfo> activeTasks = new ArrayList<>();
|
||||
private List<TaskOverviewInfo> activeTasks = new LinkedList<>();
|
||||
|
||||
public RecursiveTaskgroupInfo(Taskgroup taskgroup) {
|
||||
this.taskgroupID = taskgroup.getTaskgroupID();
|
||||
@ -24,9 +30,13 @@ public class RecursiveTaskgroupInfo {
|
||||
this.childTaskgroups.add(new RecursiveTaskgroupInfo(child));
|
||||
}
|
||||
|
||||
for(Task task : taskgroup.getTasks()) {
|
||||
for(Task task : taskgroup.getActiveTasks()) {
|
||||
this.activeTasks.add(new TaskOverviewInfo(task));
|
||||
if(task.getDeadline().isBefore(LocalDate.now())) {
|
||||
this.hasOverdueTask = true;
|
||||
}
|
||||
}
|
||||
this.amountActiveTasks = taskgroup.getAmountOfActiveTasks();
|
||||
}
|
||||
|
||||
public long getTaskgroupID() {
|
||||
@ -60,4 +70,20 @@ public class RecursiveTaskgroupInfo {
|
||||
public void setActiveTasks(List<TaskOverviewInfo> 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;
|
||||
}
|
||||
}
|
||||
|
@ -97,4 +97,22 @@ public class Taskgroup {
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -23,5 +23,13 @@ export interface RecursiveTaskgroupInfo {
|
||||
taskgroupName: string;
|
||||
childTaskgroups: Array<RecursiveTaskgroupInfo>;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -161,3 +161,7 @@
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.overdue-taskgroup {
|
||||
background-color: #ff6354;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
</mat-action-list>
|
||||
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl" >
|
||||
<!-- 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 -->
|
||||
<button mat-icon-button disabled></button>
|
||||
<div class="treenode-content-container">
|
||||
@ -13,7 +13,7 @@
|
||||
</div>
|
||||
</mat-tree-node>
|
||||
<!-- 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
|
||||
[attr.aria-label]="'Toggle ' + node.name" style="padding-left: 10px">
|
||||
<mat-icon class="mat-icon-rtl-mirror">
|
||||
@ -24,6 +24,7 @@
|
||||
<button mat-button class="node-name">{{node.name}}</button>
|
||||
<span class="spacer"></span>
|
||||
<div class="task-number">{{node.activeTasks}}</div>
|
||||
|
||||
</div>
|
||||
</mat-tree-node>
|
||||
</mat-tree>
|
||||
|
@ -14,6 +14,7 @@ interface ExampleFlatNode {
|
||||
name: string;
|
||||
level: number;
|
||||
activeTasks: number;
|
||||
hasOverdueTask: boolean
|
||||
}
|
||||
@Component({
|
||||
selector: 'app-taskgroup-overview',
|
||||
@ -26,7 +27,8 @@ export class TaskgroupOverviewComponent {
|
||||
expandable: !!node.childTaskgroups && node.childTaskgroups.length > 0,
|
||||
name: node.taskgroupName,
|
||||
level: level,
|
||||
activeTasks: node.activeTasks.length
|
||||
activeTasks: node.amountActiveTasks,
|
||||
hasOverdueTask: node.hasOverdueTask
|
||||
};
|
||||
};
|
||||
|
||||
|
10
openapi.yaml
10
openapi.yaml
@ -2002,6 +2002,8 @@ components:
|
||||
- taskgroupName
|
||||
- childTaskgroups
|
||||
- activeTasks
|
||||
- hasOverdueTask
|
||||
- amountActiveTasks
|
||||
additionalProperties: false
|
||||
properties:
|
||||
taskgroupID:
|
||||
@ -2022,6 +2024,14 @@ components:
|
||||
type: array
|
||||
items:
|
||||
$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:
|
||||
required:
|
||||
- taskID
|
||||
|
Loading…
Reference in New Issue
Block a user