diff --git a/src/index.js b/src/index.js index ddd8a6e968683ac8cc62be677a55236bd2a18a76..2ef673ecc4744eb63bda54d7296ade5fdba51574 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 } /**