From 7351b5ce08d80bb4e01acf072f0032ac77b25e42 Mon Sep 17 00:00:00 2001 From: Hugo <hnouts.dev@gmail.com> Date: Thu, 18 Feb 2021 17:23:48 +0100 Subject: [PATCH] l2log --- src/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 9e40072..aa807d2 100644 --- a/src/index.js +++ b/src/index.js @@ -15,7 +15,8 @@ moment.tz.setDefault('Europe/Paris') // set the timezone const startDate = moment() .startOf('year') - .subtract(3, 'year') + // .subtract(3, 'year') TODO PUT TERNARY EXPRESSION FOR MANUAL LAUNCH + .subtract(1, 'year') .subtract(1, 'day') .format('MM/DD/YYYY') const endDate = moment().format('MM/DD/YYYY') @@ -151,6 +152,7 @@ async function getData(response, baseUrl, apiAuthKey) { function format(response) { const data = response.resultatRetour.slice(1).map((value, index) => { const time = moment(value.DateReleve, moment.ISO_8601) + log('info', 'SUBSTRACTING : ' + value.ValeurIndex + ' - ' + response.resultatRetour[index].ValeurIndex + '\n') return { // Add if/else to not substract null value (typeagregat T) load: value.TypeAgregat === 'T' ? null : value.ValeurIndex - response.resultatRetour[index].ValeurIndex, @@ -162,7 +164,10 @@ function format(response) { type: value.TypeAgregat } }) - log('info', 'Dataload is : ' + data) + log('info', 'DATALOAD LIST\n') + data.map((value) => { + log('info', value.month + '-' + value.day + '-' + value.year + ' : ' + value.load + '\n') + }) return data } -- GitLab