Commit ffe9d4a7 authored by Christian Svensson's avatar Christian Svensson Committed by Fatih Acet

Correct state of metrics comparison

Closes #9864
parent 5d502c2d
...@@ -114,8 +114,6 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -114,8 +114,6 @@ export default class MergeRequestStore extends CEMergeRequestStore {
if (baseMetricsIndexed[subject] && baseMetricsIndexed[subject][metric]) { if (baseMetricsIndexed[subject] && baseMetricsIndexed[subject][metric]) {
const baseMetricData = baseMetricsIndexed[subject][metric]; const baseMetricData = baseMetricsIndexed[subject][metric];
const metricDirection =
'desiredSize' in headMetricData && headMetricData.desiredSize === 'smaller' ? -1 : 1;
const metricData = { const metricData = {
name: metric, name: metric,
path: subject, path: subject,
...@@ -124,7 +122,12 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -124,7 +122,12 @@ export default class MergeRequestStore extends CEMergeRequestStore {
}; };
if (metricData.delta !== 0) { if (metricData.delta !== 0) {
if (metricDirection > 0) { const isImproved =
headMetricData.desiredSize === 'smaller'
? metricData.delta < 0
: metricData.delta > 0;
if (isImproved) {
improved.push(metricData); improved.push(metricData);
} else { } else {
degraded.push(metricData); degraded.push(metricData);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment