From eed69bb0def50f5127b9a0612ad00b73878b7341 Mon Sep 17 00:00:00 2001 From: Leigh B Stoller Date: Wed, 19 Sep 2018 13:04:16 -0600 Subject: [PATCH] Handle whacky forecast info that is causing free counts table to be wrong. --- www/aptui/js/resinfo.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/www/aptui/js/resinfo.js b/www/aptui/js/resinfo.js index 813e4ed82..63150507e 100644 --- a/www/aptui/js/resinfo.js +++ b/www/aptui/js/resinfo.js @@ -160,7 +160,16 @@ $(function () } // This is an array of objects. var array = forecast[type]; + // We want the first stime stamp, but there might be + // multiple entries for that time stamp, so scan foward + // to find the last one. var data = array[0]; + for (var i in array) { + var datum = array[i]; + if (datum.t == data.t) { + data = datum; + } + } var free = parseInt(data.free) + parseInt(data.held); html += -- GitLab