From 8e6ecdff12649edbf34098cda5ca852d17ff830c Mon Sep 17 00:00:00 2001 From: Frank Niessink Date: Sat, 18 May 2024 13:26:25 +0200 Subject: [PATCH] Fix hiding metrics without issues. Hiding metrics without issues would not hide metrics with deleted issues. Fixes #8699. --- components/frontend/src/utils.js | 2 +- components/frontend/src/utils.test.js | 5 +++++ docs/src/changelog.md | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/components/frontend/src/utils.js b/components/frontend/src/utils.js index b645eaf6c6..30f0b49004 100644 --- a/components/frontend/src/utils.js +++ b/components/frontend/src/utils.js @@ -205,7 +205,7 @@ sortWithLocaleCompare.propTypes = { function hideMetric(metric, metricsToHide, hiddenTags) { const hideBecauseNoActionNeeded = metricsToHide === "no_action_needed" && ["target_met", "debt_target_met", "informative"].includes(metric.status) - const hideBecauseNoIssues = metricsToHide === "no_issues" && !metric.issue_ids + const hideBecauseNoIssues = metricsToHide === "no_issues" && !metric?.issue_ids?.length const hideBecauseTagIsHidden = hiddenTags?.length > 0 && hiddenTags?.filter((hiddenTag) => metric.tags?.includes(hiddenTag)).length >= metric.tags?.length diff --git a/components/frontend/src/utils.test.js b/components/frontend/src/utils.test.js index febff77283..60ec91dd90 100644 --- a/components/frontend/src/utils.test.js +++ b/components/frontend/src/utils.test.js @@ -337,6 +337,11 @@ it("hides metrics not requiring action or without issues", () => { expect(visibleMetrics(metricWithIssue, "no_issues", [])).toStrictEqual(metricWithIssue) expect(visibleMetrics(metricWithIssue, "none", [])).toStrictEqual(metricWithIssue) expect(visibleMetrics(metricWithIssue, "all", [])).toStrictEqual({}) + const metricWithRemovedIssue = { metric_uuid: { status: "target_met", issue_ids: [] } } + expect(visibleMetrics(metricWithRemovedIssue, "no_action_needed", [])).toStrictEqual({}) + expect(visibleMetrics(metricWithRemovedIssue, "no_issues", [])).toStrictEqual({}) + expect(visibleMetrics(metricWithRemovedIssue, "none", [])).toStrictEqual(metricWithRemovedIssue) + expect(visibleMetrics(metricWithRemovedIssue, "all", [])).toStrictEqual({}) }) it("hides metrics with hidden tags", () => { diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 227fc7eba7..1b2d2fa9e3 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -8,6 +8,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +## [Unreleased] + +### Deployment notes + +If your currently installed *Quality-time* version is v4.10.0 or older, please read the v5.0.0 deployment notes first. + +### Fixed + +- Hiding metrics without issues would not hide metrics with deleted issues. Fixes [#8699](https://github.com/ICTU/quality-time/issues/8699). + ## v5.12.0 - 2024-05-17 ### Deployment notes