Skip to content

Commit

Permalink
When calculating how much time is left until the technical debt end d…
Browse files Browse the repository at this point in the history
…ate, include the technical debt end date itself in the calculation.

Fixes #10063.
  • Loading branch information
fniessink committed Oct 25, 2024
1 parent 2888572 commit 9dd2135
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/frontend/src/metric/MetricDebtParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ function TechnicalDebtEndDate({ metric, metric_uuid, reload }) {
</p>
</>
)
let debtEndDateTime = null
if (metric.debt_end_date) {
debtEndDateTime = new Date(metric.debt_end_date)
debtEndDateTime.setHours(23, 59, 59)
}
return (
<DateInput
ariaLabelledBy={labelId}
requiredPermissions={[EDIT_REPORT_PERMISSION]}
label={
<LabelWithDate
date={metric.debt_end_date}
labelId={labelId}
help={help}
label="Technical debt end date"
/>
<LabelWithDate date={debtEndDateTime} labelId={labelId} help={help} label="Technical debt end date" />
}
placeholder="YYYY-MM-DD"
set_value={(value) => set_metric_attribute(metric_uuid, "debt_end_date", value, reload)}
Expand Down
1 change: 1 addition & 0 deletions components/frontend/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export function getMetricResponseDeadline(metric, report) {
if (status === "debt_target_met") {
if (metric.debt_end_date) {
deadline = new Date(metric.debt_end_date)
deadline.setHours(23, 59, 59)
}
} else if (status in defaultDesiredResponseTimes && metric.status_start) {
const desiredResponseTime = getDesiredResponseTime(report, status)
Expand Down
1 change: 1 addition & 0 deletions components/frontend/src/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ it("returns the metric response deadline", () => {
it("returns the metric response deadline based on the tech debt end date", () => {
const tomorrow = new Date()
tomorrow.setDate(tomorrow.getDate() + 1)
tomorrow.setHours(23, 59, 59)
expect(
getMetricResponseDeadline({ status: "debt_target_met", debt_end_date: tomorrow.toISOString() }, {}),
).toStrictEqual(tomorrow)
Expand Down
10 changes: 10 additions & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

<!-- The line "## <square-bracket>Unreleased</square-bracket>" is replaced by the release/release.py script with the new release version and release date. -->

## [Unreleased]

### Deployment notes

If your currently installed *Quality-time* version is not v5.17.1, please first check the upgrade path in the [versioning policy](versioning.md).

### Fixed

- When calculating how much time is left until the technical debt end date, include the technical debt end date itself in the calculation. Fixes [#10063](https://github.com/ICTU/quality-time/issues/10063).

## v5.17.1 - 2024-10-25

### Deployment notes
Expand Down

0 comments on commit 9dd2135

Please sign in to comment.