Commit 0b37955e authored by alain's avatar alain 🐙
Browse files

fix last hour data

parent 8d8108b9
import { getNowHourISO } from "../../data-on-a-map-app/src/util/time"
import { getLastHourISO, getNowHourISO } from "../../data-on-a-map-app/src/util/time"
import { groupArrayOfObjectsBy, renameObjectKey, addMissingHours } from "../../data-on-a-map-app/src/util/data"
const officialStations = {
......@@ -84,15 +84,16 @@ export default {
all: async function getAllLuchtmeetnet(parameter) {
try {
const lastHourISO = getLastHourISO()
const nowHourISO = getNowHourISO()
const allResponse = await fetch(`https://data.waag.org/api/getOfficialMeasurement?formula=${parameter.toUpperCase()}&start=${nowHourISO}&end=${nowHourISO}&station_id=${officialStations[parameter].join("&station_id=")}`)
const allResponse = await fetch(`https://data.waag.org/api/getOfficialMeasurement?formula=${parameter.toUpperCase()}&start=${lastHourISO}&end=${nowHourISO}&station_id=${officialStations[parameter].join("&station_id=")}`)
const all = await allResponse.json()
const dataGrouped = groupArrayOfObjectsBy(all, "station_number")
const data = dataGrouped.map(station => {
station = station[0]
station = station[station.length - 1]
renameObjectKey(station, "value", "mean")
renameObjectKey(station, "station_number", "id")
......
data-on-a-map-app @ d8af7e43
Subproject commit d89a568d7a1beeab88e7f7daec1e198e170d8361
Subproject commit d8af7e43c748207bcdf218f6e1539ff0de68a06b
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment