From 660c993a6dd0f89272c2a584ec385aa8669b22bc Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 31 May 2024 10:08:50 +0300 Subject: [PATCH] Strengthen consistency data for export --- .../helpers/is-not-contained-same-mts.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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