Skip to content
Snippets Groups Projects
Commit 27b7a717 authored by Bastien DUMONT's avatar Bastien DUMONT :angel: Committed by Hugo NOUTS
Browse files

fix(half hour analysis): service crashing

parent b41874f4
Branches
Tags
2 merge requests!905MEP 2.4 : intégration Ma Bulle,!898fix(half hour analysis): service crashing
...@@ -56,7 +56,7 @@ export default class EnedisMonthlyAnalysisDataService { ...@@ -56,7 +56,7 @@ export default class EnedisMonthlyAnalysisDataService {
} }
/** /**
* Aggregates Enedis Analysis data in order to create Dataload inhjectable in graph component * Aggregates Enedis Analysis data in order to create Dataload injectable in graph component
* @param {EnedisMonthlyAnalysisData} data * @param {EnedisMonthlyAnalysisData} data
* @returns {AggregatedEnedisMonthlyDataloads} * @returns {AggregatedEnedisMonthlyDataloads}
*/ */
......
...@@ -69,8 +69,9 @@ const populateArrayWithTotalData = ( ...@@ -69,8 +69,9 @@ const populateArrayWithTotalData = (
if (halfHourValue >= 0) { if (halfHourValue >= 0) {
if (!monthlyArray[index]) { if (!monthlyArray[index]) {
monthlyArray.push([]) monthlyArray.push([])
} else {
monthlyArray[index] = [...monthlyArray[index], halfHourValue]
} }
monthlyArray[index] = [...monthlyArray[index], halfHourValue]
} }
}) })
} }
...@@ -134,7 +135,7 @@ const getEnedisMonthAnalysisData = async ( ...@@ -134,7 +135,7 @@ const getEnedisMonthAnalysisData = async (
year: year, year: year,
} }
if (data) { if (data) {
// 48 is the number of halfhour entries in a day // 48 is the number of half-hour entries in a day
const weekEndValuesArray: number[][] = new Array([]) const weekEndValuesArray: number[][] = new Array([])
const weekValuesArray: number[][] = new Array([]) const weekValuesArray: number[][] = new Array([])
...@@ -231,7 +232,7 @@ const syncEnedisMonthlyAnalysisDataDoctype = async ({ ...@@ -231,7 +232,7 @@ const syncEnedisMonthlyAnalysisDataDoctype = async ({
) )
} }
} }
logStack('info', 'Getting first endis half hour data date') logStack('info', 'Getting first enedis half hour data date')
if (lastEnedisMonthlyAnalysis.length > 0) { if (lastEnedisMonthlyAnalysis.length > 0) {
// If user has more than one entry (already synced), fetch the full history // If user has more than one entry (already synced), fetch the full history
...@@ -242,12 +243,12 @@ const syncEnedisMonthlyAnalysisDataDoctype = async ({ ...@@ -242,12 +243,12 @@ const syncEnedisMonthlyAnalysisDataDoctype = async ({
firstEnedisMonthlyAnalysis[0]?.month === firstMinuteData[0].month && firstEnedisMonthlyAnalysis[0]?.month === firstMinuteData[0].month &&
firstEnedisMonthlyAnalysis[0]?.year === firstMinuteData[0].year firstEnedisMonthlyAnalysis[0]?.year === firstMinuteData[0].year
) { ) {
logStack('info', 'Every Enedis Anlysis already synchronized') logStack('info', 'Every Enedis Analysis already synchronized')
return return
} else if (firstEnedisMonthlyAnalysis) { } else if (firstEnedisMonthlyAnalysis) {
logStack( logStack(
'info', 'info',
'Doctype is partially completed, fetiching all available history' 'Doctype is partially completed, fetching all available history'
) )
const firstEnedisMonthlyAnalysisDate = DateTime.fromObject({ const firstEnedisMonthlyAnalysisDate = DateTime.fromObject({
year: firstEnedisMonthlyAnalysis[0].year, year: firstEnedisMonthlyAnalysis[0].year,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment