Commit b81e04f1 authored by Pithon Kabiro's avatar Pithon Kabiro
Browse files

Minor tweaks to functions

parent 05f9d528
Showing with 3 additions and 0 deletions
+3 -0
......@@ -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"]) {
......
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