Fix statistics
This commit is contained in:
		
							parent
							
								
									303de733a1
								
							
						
					
					
						commit
						10dfda9031
					
				@ -18,5 +18,6 @@ export interface TaskgroupPathInfo {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    taskgroupPath: string;
 | 
					    taskgroupPath: string;
 | 
				
			||||||
    directChildren: Array<TaskgroupEntityInfo>;
 | 
					    directChildren: Array<TaskgroupEntityInfo>;
 | 
				
			||||||
 | 
					    rootTasktroup: TaskgroupEntityInfo;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -88,10 +88,13 @@ export class TaskgroupActivityComponent implements OnInit{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  createDateRangeBetween(minValue: moment.Moment, maxValue: moment.Moment) {
 | 
					  createDateRangeBetween(minValue: moment.Moment, maxValue: moment.Moment) {
 | 
				
			||||||
    const dates: Date[] = [];
 | 
					    const dates: Date[] = [];
 | 
				
			||||||
    const numberDays = maxValue.diff(minValue, 'days');
 | 
					    let currentDate = moment(minValue);
 | 
				
			||||||
    for(let i=0; i<=numberDays; i++) {
 | 
					
 | 
				
			||||||
      dates.push(minValue.add(i, 'd').toDate());
 | 
					    while(currentDate <= maxValue) {
 | 
				
			||||||
 | 
					      dates.push(currentDate.toDate());
 | 
				
			||||||
 | 
					      currentDate = currentDate.add(1, 'days');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return dates;
 | 
					    return dates;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -100,19 +103,24 @@ export class TaskgroupActivityComponent implements OnInit{
 | 
				
			|||||||
      //console.log("onUserChangeStart" + new Date(changeContext.value));
 | 
					      //console.log("onUserChangeStart" + new Date(changeContext.value));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onUserChangeStop(changeContext: ChangeContext) {
 | 
					  onUserChangeStop(changeContext: ChangeContext) {
 | 
				
			||||||
      //console.log("onUserChangeStop" + new Date(changeContext.highValue!))
 | 
					      //console.log("onUserChangeStop" + new Date(changeContext.highValue!))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onUserChange(changeContext: ChangeContext) {
 | 
					  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()
 | 
					    this.chartOptions = this.generateChartOptions()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  generateChartOptions(): Partial<ChartOptions> {
 | 
					  generateChartOptions(): Partial<ChartOptions> {
 | 
				
			||||||
 | 
					    const series = this.generateSeries();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      series: this.generateSeries(),
 | 
					      series: series,
 | 
				
			||||||
        chart: {
 | 
					        chart: {
 | 
				
			||||||
          height: 350,
 | 
					          height: 350,
 | 
				
			||||||
          type: this.selectedChartype as ChartType,
 | 
					          type: this.selectedChartype as ChartType,
 | 
				
			||||||
@ -129,7 +137,30 @@ export class TaskgroupActivityComponent implements OnInit{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  generateSeries() : ApexAxisChartSeries {
 | 
					  generateSeries() : ApexAxisChartSeries {
 | 
				
			||||||
    const series: 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.selectedTaskgroupPath?.directChildren.forEach(taskgroup => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.historyService.statisticsTaskgroupActivityTaskgroupIDStartingDateEndingDateIncludeSubTaskgroupsGet(
 | 
					      this.historyService.statisticsTaskgroupActivityTaskgroupIDStartingDateEndingDateIncludeSubTaskgroupsGet(
 | 
				
			||||||
        taskgroup.taskgroupID,
 | 
					        taskgroup.taskgroupID,
 | 
				
			||||||
        moment(this.selectedDateRange[0]).format("YYYY-MM-DD"),
 | 
					        moment(this.selectedDateRange[0]).format("YYYY-MM-DD"),
 | 
				
			||||||
@ -146,6 +177,7 @@ export class TaskgroupActivityComponent implements OnInit{
 | 
				
			|||||||
      })
 | 
					      })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					    console.log(series);
 | 
				
			||||||
    return series;
 | 
					    return series;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -2612,6 +2612,7 @@ components:
 | 
				
			|||||||
      required:
 | 
					      required:
 | 
				
			||||||
        - taskgroupPath
 | 
					        - taskgroupPath
 | 
				
			||||||
        - directChildren
 | 
					        - directChildren
 | 
				
			||||||
 | 
					        - rootTasktroup
 | 
				
			||||||
      additionalProperties: false
 | 
					      additionalProperties: false
 | 
				
			||||||
      properties:
 | 
					      properties:
 | 
				
			||||||
        taskgroupPath:
 | 
					        taskgroupPath:
 | 
				
			||||||
@ -2621,6 +2622,9 @@ components:
 | 
				
			|||||||
          type: array
 | 
					          type: array
 | 
				
			||||||
          items:
 | 
					          items:
 | 
				
			||||||
            $ref: '#/components/schemas/TaskgroupEntityInfo'
 | 
					            $ref: '#/components/schemas/TaskgroupEntityInfo'
 | 
				
			||||||
 | 
					        rootTasktroup:
 | 
				
			||||||
 | 
					          type: object
 | 
				
			||||||
 | 
					          $ref: '#/components/schemas/TaskgroupEntityInfo'
 | 
				
			||||||
    TaskgroupActivityInfo:
 | 
					    TaskgroupActivityInfo:
 | 
				
			||||||
      required:
 | 
					      required:
 | 
				
			||||||
        - date
 | 
					        - date
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user