Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ecolyo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
Ecolyo
Commits
57c3d17b
Commit
57c3d17b
authored
Jan 11, 2023
by
Hugo NOUTS
Browse files
Options
Downloads
Patches
Plain Diff
fix over iteration
parent
e5323243
No related branches found
No related tags found
1 merge request
!791
Resolve "[Gaz] Manque la donnée du dernier jour du mois"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/services/queryRunner.service.ts
+9
-14
9 additions, 14 deletions
src/services/queryRunner.service.ts
with
9 additions
and
14 deletions
src/services/queryRunner.service.ts
+
9
−
14
View file @
57c3d17b
...
@@ -111,18 +111,16 @@ export default class QueryRunner {
...
@@ -111,18 +111,16 @@ export default class QueryRunner {
timePeriod
:
TimePeriod
,
timePeriod
:
TimePeriod
,
timeStep
:
TimeStep
timeStep
:
TimeStep
)
{
)
{
const
filterData
=
(
entry
:
any
,
timeStep
:
TimeStep
,
timePeriod
:
TimePeriod
)
=>
{
const
hour
=
timeStep
===
TimeStep
.
HALF_AN_HOUR
?
entry
.
hour
:
0
const
min
=
timeStep
===
TimeStep
.
HALF_AN_HOUR
?
entry
.
minute
:
0
if
(
timeStep
===
TimeStep
.
HALF_AN_HOUR
)
{
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
// 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
.
startDate
=
timePeriod
.
startDate
.
plus
({
minutes
:
30
})
timePeriod
.
endDate
=
timePeriod
.
endDate
.
plus
({
minutes
:
30
})
timePeriod
.
endDate
=
timePeriod
.
endDate
.
plus
({
minutes
:
30
})
}
}
const
filteredResult
=
data
.
data
.
filter
((
entry
:
any
)
=>
{
// add ternary expression to not send to the withinDate function an hour different than zero
const
hour
=
timeStep
===
TimeStep
.
HALF_AN_HOUR
?
entry
.
hour
:
0
const
min
=
timeStep
===
TimeStep
.
HALF_AN_HOUR
?
entry
.
minute
:
0
return
this
.
withinDateBoundaries
(
return
this
.
withinDateBoundaries
(
DateTime
.
local
(
DateTime
.
local
(
entry
.
year
,
entry
.
year
,
...
@@ -135,10 +133,7 @@ export default class QueryRunner {
...
@@ -135,10 +133,7 @@ export default class QueryRunner {
}),
}),
timePeriod
timePeriod
)
)
}
})
const
filteredResult
=
data
.
data
.
filter
((
entry
:
any
)
=>
filterData
(
entry
,
timeStep
,
timePeriod
)
)
return
filteredResult
return
filteredResult
}
}
...
...
This diff is collapsed.
Click to expand it.
Hugo NOUTS
@hnouts
mentioned in commit
23158e4f
·
Jan 11, 2023
mentioned in commit
23158e4f
mentioned in commit 23158e4f4568b1cd086326424a35ad0239bd9b8f
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment