Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed display of progress of current sprint and added dates display t… #106

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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].replaceAll("-", "/");
}

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].replaceAll("-", "/");
}

}
Loading