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

oups

parent 8dff6231
No related branches found
No related tags found
1 merge request!924Resolve "[DJU] L'api et la donnée va changer suite à l'abandon de SOS 52north"
...@@ -507,21 +507,34 @@ export default class ProfileTypeService { ...@@ -507,21 +507,34 @@ export default class ProfileTypeService {
.endOf('month') .endOf('month')
.plus({ minutes: 5 }) .plus({ minutes: 5 })
.toISO() .toISO()
console.log('MY DATE : ', startDate, endDate)
// We add or remove 5 minutes so the api returns the exact period // We add or remove 5 minutes so the api returns the exact period
try { try {
const result = await this._client const result = await this._client
.getStackClient() .getStackClient()
.fetchJSON( .fetchJSON(
'GET', 'GET',
`/remote/org.ecolyo.dju?observedProperty=degreeDay&startDate=${startDate}&endDate=${endDate}` `/remote/org.ecolyo.dju_v2?startDate=${startDate}&endDate=${endDate}`
) )
let monthDju = 0 const monthDju = 0
if (result) { if (result) {
for (const observation of result.observations) { const degreeDayObservations = result.values.filter(
monthDju += observation.result.value value => value.observation === 'degreeDay'
)
let monthDju = 0
for (const observation of degreeDayObservations) {
monthDju += observation.measurement
}
if (monthDju === 0) {
return heatingData.dju_average_by_month[month - 1]
} else {
return monthDju
} }
} }
console.log('DJU MONTH : ', monthDju)
if (monthDju === 0) { if (monthDju === 0) {
return heatingData.dju_average_by_month[month - 1] return heatingData.dju_average_by_month[month - 1]
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment