diff --git a/src/index.js b/src/index.js index 9e4007292ca76b1f92e23b08bf3737ac48a2184c..aa807d28050b08622117f5a99bda14b56a7322ec 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 }