diff --git a/services/fluidsPrices/ecolyo.js b/services/fluidsPrices/ecolyo.js index da36290a8ad35d524ff1e7ee4fdf08a1bddaf618..f272577f549f4e5ef99fa57e995afa6674b1248b 100644 --- a/services/fluidsPrices/ecolyo.js +++ b/services/fluidsPrices/ecolyo.js @@ -76017,8 +76017,8 @@ const aggregatePrices = async (qr, cdm, firstDate, today, fluidType) => { Object.assign(date, firstDate); - try { - do { + do { + try { log('info', `Step: ${ts} | Fluid: ${fluidType} | Date: ${date.day}/${date.month}/${date.year}`); const tp = await getTimePeriod(ts, date); // Get doc for aggregation @@ -76033,8 +76033,11 @@ const aggregatePrices = async (qr, cdm, firstDate, today, fluidType) => { } // Save updated docs - await cdm.saveDocs(docToUpdate.data); // Update date according to timestep - + await cdm.saveDocs(docToUpdate.data); + } catch (err) { + log('error', `Error : ${err}`); + } finally { + // Update date according to timestep if (ts === _timeStep.TimeStep.YEAR) { log('info', `YEEEEEEEEEEEEAAAAARR`); date = date.plus({ @@ -76045,12 +76048,10 @@ const aggregatePrices = async (qr, cdm, firstDate, today, fluidType) => { month: 1 }).startOf('month'); } - } while (date < today); - } catch (err) { - log('error', `Error : ${err}`); - } finally { - resolve(); - } + } + } while (date < today); + + resolve(); }); })); log('debug', `Aggregation done`);