Commit 38d9c06f authored by Hugo's avatar Hugo
Browse files

logs

parent 20bad20a
......@@ -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")),
......
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