diff --git a/workers/loc.api/helpers/prepare-response/helpers/is-not-contained-same-mts.js b/workers/loc.api/helpers/prepare-response/helpers/is-not-contained-same-mts.js index 9eb830a5..5011f950 100644 --- a/workers/loc.api/helpers/prepare-response/helpers/is-not-contained-same-mts.js +++ b/workers/loc.api/helpers/prepare-response/helpers/is-not-contained-same-mts.js @@ -2,6 +2,14 @@ const { getMethodLimit } = require('../../limit-param.helpers') +const checkLength = (apiRes, apiMethodName) => { + if (apiMethodName === 'candles') { + return apiRes.length <= 1 + } + + return apiRes.length === 0 +} + module.exports = (args, opts) => { const { apiRes, @@ -27,7 +35,7 @@ module.exports = (args, opts) => { ) return ( - apiRes.length <= 1 || // Check makes sense to prevent double requests to api + checkLength(apiRes, apiMethodName) || // Check makes sense to prevent double requests to api methodLimit > limit || apiRes.some((item) => ( item?.[datePropName] !== mts