Include root Taskgroup in statistics and sort activityData by dates
This commit is contained in:
parent
29a74b934a
commit
303de733a1
@ -23,6 +23,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -59,7 +60,14 @@ public class StatisticController {
|
|||||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok(taskgroupPermissionResult.getResult().calcActivityInfo(includeSubTaskgroups,
|
List<TaskgroupActivityInfo> activityInfos = taskgroupPermissionResult.getResult().calcActivityInfo(includeSubTaskgroups,
|
||||||
LocalDate.parse(startingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")), LocalDate.parse(endingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
|
LocalDate.parse(startingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")), LocalDate.parse(endingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||||
|
activityInfos.sort(new Comparator<TaskgroupActivityInfo>() {
|
||||||
|
@Override
|
||||||
|
public int compare(TaskgroupActivityInfo o1, TaskgroupActivityInfo o2) {
|
||||||
|
return o1.getDate().compareTo(o2.getDate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return ResponseEntity.ok(activityInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,12 @@ public class TaskgroupActivityInfo {
|
|||||||
this.date = localDate;
|
this.date = localDate;
|
||||||
this.activeMinutes = activeMinutes;
|
this.activeMinutes = activeMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LocalDate getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getActiveMinutes() {
|
||||||
|
return activeMinutes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ public class TaskgroupPathInfo {
|
|||||||
@JsonProperty
|
@JsonProperty
|
||||||
private String taskgroupPath;
|
private String taskgroupPath;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private TaskgroupEntityInfo rootTasktroup;
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private List<TaskgroupEntityInfo> directChildren;
|
private List<TaskgroupEntityInfo> directChildren;
|
||||||
public TaskgroupPathInfo(Taskgroup taskgroup) {
|
public TaskgroupPathInfo(Taskgroup taskgroup) {
|
||||||
@ -21,6 +24,7 @@ public class TaskgroupPathInfo {
|
|||||||
stringBuilder.append("/");
|
stringBuilder.append("/");
|
||||||
}
|
}
|
||||||
this.taskgroupPath = stringBuilder.substring(0, stringBuilder.length()-1);
|
this.taskgroupPath = stringBuilder.substring(0, stringBuilder.length()-1);
|
||||||
|
this.rootTasktroup = new TaskgroupEntityInfo(taskgroup);
|
||||||
directChildren = taskgroup.getChildren().stream().map(TaskgroupEntityInfo::new).toList();
|
directChildren = taskgroup.getChildren().stream().map(TaskgroupEntityInfo::new).toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user