diff --git a/.changeset/cold-seas-repeat.md b/.changeset/cold-seas-repeat.md new file mode 100644 index 0000000000..0072c4327d --- /dev/null +++ b/.changeset/cold-seas-repeat.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-code-coverage': patch +--- + +Fixed the coverage history statistics to compare newest with oldest record diff --git a/plugins/code-coverage/src/components/CoverageHistoryChart/CoverageHistoryChart.tsx b/plugins/code-coverage/src/components/CoverageHistoryChart/CoverageHistoryChart.tsx index 1e5341eb50..09f499fafd 100644 --- a/plugins/code-coverage/src/components/CoverageHistoryChart/CoverageHistoryChart.tsx +++ b/plugins/code-coverage/src/components/CoverageHistoryChart/CoverageHistoryChart.tsx @@ -113,8 +113,8 @@ export const CoverageHistoryChart = () => { ); } - const oldestCoverage = valueHistory.history[0]; - const [latestCoverage] = valueHistory.history.slice(-1); + const [oldestCoverage] = valueHistory.history.slice(-1); + const latestCoverage = valueHistory.history[0]; const getTrendForCoverage = (type: Coverage) => { if (!oldestCoverage[type].percentage) {