Commit 27cbf0ff authored by Fatih Acet's avatar Fatih Acet

Merge branch '9864-fix-performance-widget-comparison' into 'master'

Correct state of metrics comparison

Closes #9864

See merge request gitlab-org/gitlab-ee!9635
parents 5d502c2d ffe9d4a7
......@@ -114,8 +114,6 @@ export default class MergeRequestStore extends CEMergeRequestStore {
if (baseMetricsIndexed[subject] && baseMetricsIndexed[subject][metric]) {
const baseMetricData = baseMetricsIndexed[subject][metric];
const metricDirection =
'desiredSize' in headMetricData && headMetricData.desiredSize === 'smaller' ? -1 : 1;
const metricData = {
name: metric,
path: subject,
......@@ -124,7 +122,12 @@ export default class MergeRequestStore extends CEMergeRequestStore {
};
if (metricData.delta !== 0) {
if (metricDirection > 0) {
const isImproved =
headMetricData.desiredSize === 'smaller'
? metricData.delta < 0
: metricData.delta > 0;
if (isImproved) {
improved.push(metricData);
} else {
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