Skip to content

Commit

Permalink
fixed display of progress of current sprint and added dates display t…
Browse files Browse the repository at this point in the history
…o sprints
  • Loading branch information
Igor Kedzierawski committed May 6, 2024
1 parent 03d666f commit 591e4c1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
<button mat-icon-button color="primary" (click)="switchDisplayedSprint(false)" [disabled]="!previousSprint">
<mat-icon>navigate_before</mat-icon>
</button>
<h1 class="text-3xl">{{ currentSprint.sprintName }}</h1>
<div class="text-center">
<h1 class="text-3xl">{{ currentSprint.sprintName }}</h1>
<span class="flex items-center space-x-2 text-sm">
<span class="font-bold text-white">{{ formatDate(currentSprint.startDate) }}</span>
<span></span>
<span class="font-bold text-white">{{ formatDate(currentSprint.endDate) }}</span>
</span>
</div>
<button mat-icon-button color="primary" (click)="switchDisplayedSprint(true)" [disabled]="!nextSprint">
<mat-icon>navigate_next</mat-icon>
</button>
Expand Down
4 changes: 4 additions & 0 deletions corn-frontend/src/app/pages/boards/board/board.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ export class BoardComponent implements OnInit {
};
}

protected formatDate(date: Date): string {
return date.toISOString().split('T')[0].replace("-", "/");
}

protected readonly TaskGroupingEnum: typeof TaskGrouping = TaskGrouping;
protected readonly TASK_GROUPINGS: TaskGrouping[] = Object.values(TaskGrouping);
protected readonly GROUPERS: { [key in TaskGrouping]: TaskGrouper<GroupingMetadata>; } = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
<button mat-icon-button color="primary" (click)="switchDisplayedSprint(false)" [disabled]="!previousSprint">
<mat-icon>navigate_before</mat-icon>
</button>
<h1 class="text-3xl">{{ currentSprint.sprintName }}</h1>
<div class="text-center">
<h1 class="text-3xl">{{ currentSprint.sprintName }}</h1>
<span class="flex items-center space-x-2 text-sm">
<span class="font-bold text-white">{{ formatDate(currentSprint.startDate) }}</span>
<span></span>
<span class="font-bold text-white">{{ formatDate(currentSprint.endDate) }}</span>
</span>
</div>
<button mat-icon-button color="primary" (click)="switchDisplayedSprint(true)" [disabled]="!nextSprint">
<mat-icon>navigate_next</mat-icon>
</button>
Expand Down
33 changes: 21 additions & 12 deletions corn-frontend/src/app/pages/boards/reports/reports.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,26 @@ export class ReportsComponent implements AfterViewInit {
.forEach(bucket => bucket.remainingTasks--);
});

this.updateDatapoints(buckets);
}
const theNextDayTime = new Date().getTime() + dayLengthMs;
const completedAndCurrentBuckets = buckets
.filter(bucket => bucket.date.getTime() <= theNextDayTime);

private updateDatapoints(buckets: Bucket[]) {
const actualPoints = buckets.map(bucket => {
return ({
x: bucket.date,
y: bucket.remainingTasks,
});
});
const ideal = [{ ...actualPoints[0] }, { ...actualPoints.at(-1) }];
ideal[1]!.y = 0;
const idealBoundaries = [
{ remainingTasks: allTasksInSprintCount, date: startDate, },
{ remainingTasks: 0, date: endDate, },
];

this.updateDatapoints(completedAndCurrentBuckets, idealBoundaries);
}

private updateDatapoints(actual: Bucket[], ideal: Bucket[]) {
const [actualPoints, idealPoints] = [actual, ideal].map(buckets =>
buckets.map(bucket => {
return { x: bucket.date, y: bucket.remainingTasks, };
})
);
this.chart.options.data[0].dataPoints = actualPoints;
this.chart.options.data[1].dataPoints = ideal;
this.chart.options.data[1].dataPoints = idealPoints;
this.chart.render();
}

Expand All @@ -172,4 +177,8 @@ export class ReportsComponent implements AfterViewInit {
};
}

protected formatDate(date: Date): string {
return date.toISOString().split('T')[0].replace("-", "/");
}

}

0 comments on commit 591e4c1

Please sign in to comment.