Skip to content
Snippets Groups Projects
Commit 76ca90d7 authored by Hugo NOUTS's avatar Hugo NOUTS
Browse files

fix(conso): When consulting grdf charts on week or month timestep, last month...

fix(conso): When consulting grdf charts on week or month timestep, last month day or week day was missing data.
parent 4e0e36cd
No related branches found
No related tags found
2 merge requests!8052.1,!791Resolve "[Gaz] Manque la donnée du dernier jour du mois"
......@@ -111,25 +111,29 @@ export default class QueryRunner {
timePeriod: TimePeriod,
timeStep: TimeStep
) {
// increase timeperiod range because the last data for a day is actually stored the next day at 00:00
if (timeStep === TimeStep.HALF_AN_HOUR) {
// increase timeperiod range because the last data for a day is actually stored the next day at 00:00
timePeriod.startDate = timePeriod.startDate.plus({ minutes: 30 })
timePeriod.endDate = timePeriod.endDate.plus({ minutes: 30 })
}
const filteredResult = data.data.filter((entry: any) =>
this.withinDateBoundaries(
const filteredResult = data.data.filter((entry: any) => {
// added ternary expression to not send to withinDateBoundaries an hour different than zero when not in half-hour mode
const hour = timeStep === TimeStep.HALF_AN_HOUR ? entry.hour : 0
const min = timeStep === TimeStep.HALF_AN_HOUR ? entry.minute : 0
return this.withinDateBoundaries(
DateTime.local(
entry.year,
entry.month || 1,
entry.day || 1,
entry.hour,
entry.minute
hour,
min
).setZone('utc', {
keepLocalTime: true,
}),
timePeriod
)
)
})
return filteredResult
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment