From 7e279bb4dbc045f7f22ca7c0091b47fd4a0408bc Mon Sep 17 00:00:00 2001 From: git-directory-deploy <> Date: Wed, 16 Dec 2020 10:50:42 +0100 Subject: [PATCH] feat: get history for load data --- src/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index ddd8a6e..2ef673e 100644 --- a/src/index.js +++ b/src/index.js @@ -134,12 +134,13 @@ async function getDailyData(token, usagePointID) { * If yes only call once the api */ async function startLoadDataProcess(token, usagePointID) { - const isHistory = await isHistoryLoaded('com.grandlyon.enedis.hour') + log('info', 'Check history') + const isHistory = await isHistoryLoaded('com.grandlyon.enedis.minute') if (isHistory) { - log('info', 'launc process without history') + log('info', 'launch process without history') await launchLoadDataProcess(token, usagePointID, startLoadDate, endDate) } else { - log('info', 'launc process with history') + log('info', 'launch process with history') for (var i = 1; i < 5; i++) { await launchLoadDataProcess( token, @@ -409,9 +410,11 @@ async function isHistoryLoaded(doctype) { }) if (filtered.length > 0) { return false + } else { + return true } } - return true + return false } /** -- GitLab