From b81e04f12327d813ab11951e5fb6ce2f6faab9e2 Mon Sep 17 00:00:00 2001 From: Pithon Kabiro <pithon.kabiro@hft-stuttgart.de> Date: Thu, 24 Jun 2021 16:28:26 +0200 Subject: [PATCH] Minor tweaks to functions --- public/js/appChart.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/js/appChart.js b/public/js/appChart.js index 0034587..953024e 100644 --- a/public/js/appChart.js +++ b/public/js/appChart.js @@ -125,6 +125,7 @@ export const PARAM_SELECT = "result,phenomenonTime"; * @returns {Array} Array of formatted observations suitable for use in a heatmap */ export const formatSTAResponseForHeatMap = function (obsArray) { + if (!obsArray) return; const dataSTAFormatted = []; obsArray.forEach((obs) => { // Get the date/time string; first element in input array; remove trailing "Z" @@ -246,6 +247,7 @@ export const drawHeatMapHC = function (formattedObsArrayForHeatmap) { * @returns {Array} Array of formatted observations suitable for use in a line chart */ export const formatSTAResponseForLineChart = function (obsArray) { + if (!obsArray) return; const dataSTAFormatted = []; obsArray.forEach((result) => { const timestampObs = new Date(result[0].slice(0, -1)).getTime(); // slice() removes trailing "Z" character in timestamp @@ -302,6 +304,7 @@ export const drawLineChartHC = function (formattedObsArrayForLineChart) { * @returns {Object} - Object containing results from all the "@iot.nextLink" links */ export const followNextLink = function (responsePromise) { + if (!responsePromise) return; return responsePromise .then(function (lastSuccess) { if (lastSuccess.data["@iot.nextLink"]) { -- GitLab