fix-statistics #89

Merged
sebastian merged 4 commits from fix-statistics into master 2023-12-20 18:29:52 +01:00
3 changed files with 42 additions and 5 deletions
Showing only changes of commit 10dfda9031 - Show all commits

View File

@ -18,5 +18,6 @@ export interface TaskgroupPathInfo {
*/
taskgroupPath: string;
directChildren: Array<TaskgroupEntityInfo>;
rootTasktroup: TaskgroupEntityInfo;
}

View File

@ -88,10 +88,13 @@ export class TaskgroupActivityComponent implements OnInit{
createDateRangeBetween(minValue: moment.Moment, maxValue: moment.Moment) {
const dates: Date[] = [];
const numberDays = maxValue.diff(minValue, 'days');
for(let i=0; i<=numberDays; i++) {
dates.push(minValue.add(i, 'd').toDate());
let currentDate = moment(minValue);
while(currentDate <= maxValue) {
dates.push(currentDate.toDate());
currentDate = currentDate.add(1, 'days');
}
return dates;
}
@ -100,19 +103,24 @@ export class TaskgroupActivityComponent implements OnInit{
//console.log("onUserChangeStart" + new Date(changeContext.value));
}
onUserChangeStop(changeContext: ChangeContext) {
//console.log("onUserChangeStop" + new Date(changeContext.highValue!))
}
onUserChange(changeContext: ChangeContext) {
const dateRange = this.createDateRangeBetween(moment(changeContext.value), moment(changeContext.highValue!))
console.log("min " + moment(changeContext.value).format("YYYY-MM-DD"));
console.log("max " + moment(changeContext.highValue!).format("YYYY-MM-DD"))
this.selectedDateRange = this.createDateRangeBetween(moment(changeContext.value), moment(changeContext.highValue!))
this.chartOptions = this.generateChartOptions()
}
generateChartOptions(): Partial<ChartOptions> {
const series = this.generateSeries();
return {
series: this.generateSeries(),
series: series,
chart: {
height: 350,
type: this.selectedChartype as ChartType,
@ -129,7 +137,30 @@ export class TaskgroupActivityComponent implements OnInit{
generateSeries() : ApexAxisChartSeries {
const series: ApexAxisChartSeries = []
if(this.selectedTaskgroupPath != undefined) {
this.historyService.statisticsTaskgroupActivityTaskgroupIDStartingDateEndingDateIncludeSubTaskgroupsGet(
this.selectedTaskgroupPath!.rootTasktroup.taskgroupID,
moment(this.selectedDateRange[0]).format("YYYY-MM-DD"),
moment(this.selectedDateRange[this.selectedDateRange.length-1]).format("YYYY-MM-DD"),
false
).subscribe({
next: resp => {
series.push(
{
name: this.selectedTaskgroupPath!.rootTasktroup.taskgroupName,
data: resp.map(dailyActivityInfo => dailyActivityInfo.activeMinutes)
}
);
}
})
}
this.selectedTaskgroupPath?.directChildren.forEach(taskgroup => {
this.historyService.statisticsTaskgroupActivityTaskgroupIDStartingDateEndingDateIncludeSubTaskgroupsGet(
taskgroup.taskgroupID,
moment(this.selectedDateRange[0]).format("YYYY-MM-DD"),
@ -146,6 +177,7 @@ export class TaskgroupActivityComponent implements OnInit{
})
})
console.log(series);
return series;
}

View File

@ -2612,6 +2612,7 @@ components:
required:
- taskgroupPath
- directChildren
- rootTasktroup
additionalProperties: false
properties:
taskgroupPath:
@ -2621,6 +2622,9 @@ components:
type: array
items:
$ref: '#/components/schemas/TaskgroupEntityInfo'
rootTasktroup:
type: object
$ref: '#/components/schemas/TaskgroupEntityInfo'
TaskgroupActivityInfo:
required:
- date