Commit 05f9d528 authored by Pithon Kabiro's avatar Pithon Kabiro
Browse files

Edit function that maps buildings to datastreams

Fix typo in one of the property names. Perform minor tweaks to function.
No related merge requests found
Showing with 6 additions and 4 deletions
+6 -4
......@@ -18,9 +18,6 @@ export const getDatastreamIdFromBuildingNumber = function (
phenomenon,
samplingRate
) {
// Ensure that building number passed here is numeric
if (!Number.isInteger(buildingNumber)) return;
const buildingToDatastreamMapping = {
101: {
vl: { "15min": "69", "60min": "75" },
......@@ -46,7 +43,7 @@ export const getDatastreamIdFromBuildingNumber = function (
energy: { "15min": "119", "60min": "125" },
energy_verb: { "15min": "131", "60min": "137" },
},
"112_118": {
"112, 118": {
vl: { "15min": "72", "60min": "78" },
rl: { "15min": "84", "60min": "90" },
flow: { "15min": "96", "60min": "102" },
......@@ -72,6 +69,11 @@ export const getDatastreamIdFromBuildingNumber = function (
},
};
if (!buildingNumber) return;
// check if building is contained in mapping object
if (!(buildingNumber in buildingToDatastreamMapping)) return;
const datastreamIdMatched = Number(
buildingToDatastreamMapping[buildingNumber][phenomenon][samplingRate]
);
......
Supports Markdown
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