From 0cab72aeeb2524fd9394b6920e8209d8f71ab8cc Mon Sep 17 00:00:00 2001 From: Hugo <hnouts.dev@gmail.com> Date: Fri, 19 Feb 2021 11:14:12 +0100 Subject: [PATCH] fix typo --- src/index.js | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/src/index.js b/src/index.js index c8a4205..27a1733 100644 --- a/src/index.js +++ b/src/index.js @@ -148,31 +148,33 @@ async function getData(response, baseUrl, apiAuthKey) { } function format(response) { - const data = response.resultatRetour.slice(1).filter(value => { - value.TypeAgregat === "R" - }).map((value, index) => { - const time = moment(value.DateReleve, moment.ISO_8601) - log( - 'info', - 'date -> ' + value.DateReleve + ' SUBSTRACTING : ' + - value.ValeurIndex + - ' - ' + - response.resultatRetour[index].ValeurIndex + - '\n' - ) - return { - load: - value.TypeAgregat === 'T' - ? null - : value.ValeurIndex - response.resultatRetour[index].ValeurIndex, - year: parseInt(time.format('YYYY')), - month: parseInt(time.format('M')), - day: parseInt(time.format('D')), - hour: 0, - minute: 0, - type: value.TypeAgregat - } - }) + const data = response.resultatRetour + .slice(1) + .filter(value => { + value.TypeAgregat === 'R' + }) + .map((value, index) => { + const time = moment(value.DateReleve, moment.ISO_8601) + log( + 'info', + 'date -> ' + + value.DateReleve + + ' SUBSTRACTING : ' + + value.ValeurIndex + + ' - ' + + response.resultatRetour[index].ValeurIndex + + '\n' + ) + return { + load: value.ValeurIndex - response.resultatRetour[index].ValeurIndex, + year: parseInt(time.format('YYYY')), + month: parseInt(time.format('M')), + day: parseInt(time.format('D')), + hour: 0, + minute: 0, + type: value.TypeAgregat + } + }) log('info', 'DATALOAD LIST\n') data.map(value => { log( -- GitLab