diff --git a/server/services/utils/__tests__/adHelpers.test.js b/server/services/utils/__tests__/adHelpers.test.js index 16a2dc613..2adb8fc9f 100644 --- a/server/services/utils/__tests__/adHelpers.test.js +++ b/server/services/utils/__tests__/adHelpers.test.js @@ -72,7 +72,7 @@ describe('helpers', () => { dataStartTime: 1587929940000, dataEndTime: 1587930000000, anomalyGrade: 0, - confidence: 0, + confidence: '0.99', plotTime: 1587929970000, }, { @@ -80,7 +80,7 @@ describe('helpers', () => { dataStartTime: 1587930420000, dataEndTime: 1587930480000, anomalyGrade: 0, - confidence: 0, + confidence: '0.99', plotTime: 1587930450000, }, ], diff --git a/server/services/utils/adHelpers.js b/server/services/utils/adHelpers.js index 96b047d80..d909a04e5 100644 --- a/server/services/utils/adHelpers.js +++ b/server/services/utils/adHelpers.js @@ -22,7 +22,7 @@ export const anomalyResultMapper = (anomalyResults) => { ? Number.parseFloat(rest.anomalyGrade).toFixed(2) : 0, confidence: - rest.anomalyGrade != null && rest.anomalyGrade > 0 + rest.confidence != null && rest.confidence > 0 ? Number.parseFloat(rest.confidence).toFixed(2) : 0, plotTime: rest.dataStartTime + Math.floor((rest.dataEndTime - rest.dataStartTime) / 2),