From 38d9c06f987d10a9be3424059540f1c812647134 Mon Sep 17 00:00:00 2001 From: Hugo <hnouts.dev@gmail.com> Date: Fri, 19 Feb 2021 15:17:54 +0100 Subject: [PATCH] logs --- src/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 1c39be0..f660550 100644 --- a/src/index.js +++ b/src/index.js @@ -15,8 +15,8 @@ moment.tz.setDefault("Europe/Paris"); // set the timezone const startDate = moment() .startOf("year") - // .subtract(3, 'year') TODO PUT TERNARY EXPRESSION FOR MANUAL LAUNCH - .subtract(1, "year") + // .subtract(3, "year") + .subtract(6, 'month') .subtract(1, "day") .format("MM/DD/YYYY"); const endDate = moment().format("MM/DD/YYYY"); @@ -71,7 +71,12 @@ async function processData(timeStep, response, baseUrl, apiAuthKey) { log("info", "Saving data to Cozy"); log("info", "Response length : " + loadProfile.length); if (doctype === rangeDate.day.doctype) { - log("info", "Saving daily data" + loadProfile); + loadProfile.map(v => { + log( + "info", + "Saving daily data " + v.load + " for " + v.day + "/" + v.month + ); + }); await storeData(loadProfile, rangeDate.day.doctype, rangeDate.day.keys); } else if (doctype === rangeDate.month.doctype) { await resetInProgressAggregatedData(rangeDate.month.doctype); @@ -153,6 +158,7 @@ function format(response) { .slice(1) .filter(value => value.ValeurIndex); const dataLen = data.length; + log("info", "filtered size is : " + dataLen); const mapData = data.map((value, index) => { const time = moment(value.DateReleve, moment.ISO_8601); if (index + 1 < dataLen) { @@ -163,7 +169,10 @@ function format(response) { " SUBSTRACTING : " + data[index + 1].ValeurIndex + " - " + - value.ValeurIndex + ' == ' + data[index + 1].ValeurIndex - value.ValeurIndex + + value.ValeurIndex + + " == " + + data[index + 1].ValeurIndex - + value.ValeurIndex + "\n" ); return { @@ -176,6 +185,7 @@ function format(response) { type: value.TypeAgregat }; } else { + log("info", "end of data - date is : " + value.DateReleve); return { load: null, year: parseInt(time.format("YYYY")), -- GitLab