Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
egl_konnector
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
egl_konnector
Commits
3365060f
Commit
3365060f
authored
4 years ago
by
Hugo
Browse files
Options
Downloads
Patches
Plain Diff
filter map
parent
7351b5ce
No related branches found
Branches containing commit
No related tags found
1 merge request
!4
Dev
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/index.js
+27
-8
27 additions, 8 deletions
src/index.js
with
27 additions
and
8 deletions
src/index.js
+
27
−
8
View file @
3365060f
...
...
@@ -47,8 +47,6 @@ async function start(fields, cozyParameters) {
// await resetData()
const
baseUrl
=
cozyParameters
.
secret
.
eglBaseURL
const
apiAuthKey
=
cozyParameters
.
secret
.
eglAPIAuthKey
log
(
'
info
'
,
'
Start fields are :
'
+
fields
)
log
(
'
info
'
,
'
Authenticating ...
'
)
const
response
=
await
authenticate
(
fields
.
login
,
...
...
@@ -150,12 +148,23 @@ async function getData(response, baseUrl, apiAuthKey) {
}
function
format
(
response
)
{
const
data
=
response
.
resultatRetour
.
slice
(
1
).
map
((
value
,
index
)
=>
{
const
data
=
response
.
resultatRetour
.
slice
(
1
).
filter
(
value
=>
{
value
.
TypeAgregat
===
"
R
"
}).
map
((
value
,
index
)
=>
{
const
time
=
moment
(
value
.
DateReleve
,
moment
.
ISO_8601
)
log
(
'
info
'
,
'
SUBSTRACTING :
'
+
value
.
ValeurIndex
+
'
-
'
+
response
.
resultatRetour
[
index
].
ValeurIndex
+
'
\n
'
)
log
(
'
info
'
,
'
date ->
'
+
value
.
DateReleve
+
'
SUBSTRACTING :
'
+
value
.
ValeurIndex
+
'
-
'
+
response
.
resultatRetour
[
index
].
ValeurIndex
+
'
\n
'
)
return
{
// Add if/else to not substract null value (typeagregat T)
load
:
value
.
TypeAgregat
===
'
T
'
?
null
:
value
.
ValeurIndex
-
response
.
resultatRetour
[
index
].
ValeurIndex
,
load
:
value
.
TypeAgregat
===
'
T
'
?
null
:
value
.
ValeurIndex
-
response
.
resultatRetour
[
index
].
ValeurIndex
,
year
:
parseInt
(
time
.
format
(
'
YYYY
'
)),
month
:
parseInt
(
time
.
format
(
'
M
'
)),
day
:
parseInt
(
time
.
format
(
'
D
'
)),
...
...
@@ -165,8 +174,18 @@ function format(response) {
}
})
log
(
'
info
'
,
'
DATALOAD LIST
\n
'
)
data
.
map
((
value
)
=>
{
log
(
'
info
'
,
value
.
month
+
'
-
'
+
value
.
day
+
'
-
'
+
value
.
year
+
'
:
'
+
value
.
load
+
'
\n
'
)
data
.
map
(
value
=>
{
log
(
'
info
'
,
value
.
month
+
'
-
'
+
value
.
day
+
'
-
'
+
value
.
year
+
'
:
'
+
value
.
load
+
'
\n
'
)
})
return
data
}
...
...
This diff is collapsed.
Click to expand it.
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