Calcule date de fin en fonction du temps estimé
This commit is contained in:
@@ -122,6 +122,24 @@ export class IssueDetail {
|
||||
|
||||
protected set estimatedTimeValue(value: number | null) {
|
||||
this.issue.estimatedTime = value === null || value === undefined ? null : Number(value);
|
||||
this.recalculateEndDate();
|
||||
}
|
||||
|
||||
private recalculateEndDate(): void {
|
||||
const { startDate, estimatedTime } = this.issue;
|
||||
if (!startDate || estimatedTime === null || estimatedTime <= 0) {
|
||||
this.issue.endDate = '';
|
||||
return;
|
||||
}
|
||||
const start = new Date(startDate);
|
||||
const extraDays = Math.max(0, Math.ceil(estimatedTime / 8) - 1);
|
||||
start.setDate(start.getDate() + extraDays);
|
||||
this.issue.endDate = start.toISOString().split('T')[0];
|
||||
}
|
||||
|
||||
protected onStartDateBlur(): void {
|
||||
this.recalculateEndDate();
|
||||
this.saveIssue();
|
||||
}
|
||||
|
||||
protected get issueTypeValue(): IssueEntity['type'] {
|
||||
|
||||
Reference in New Issue
Block a user