Commit 7351b5ce authored by Hugo's avatar Hugo
Browse files

l2log

parent 1af5aad9
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment