From 577a6de5547eda3d04ec3d1ce0bb52386288f786 Mon Sep 17 00:00:00 2001 From: Billy Jacobson Date: Fri, 5 Apr 2024 18:54:07 -0400 Subject: [PATCH] update 0 case --- .../data-dash/webapp/static/js/script.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/data-analytics/data-dash/webapp/static/js/script.js b/data-analytics/data-dash/webapp/static/js/script.js index 4f8c51f..6b7dfd7 100644 --- a/data-analytics/data-dash/webapp/static/js/script.js +++ b/data-analytics/data-dash/webapp/static/js/script.js @@ -24,10 +24,15 @@ $(document).ready(function () { Object.values(statusClassesMap).forEach(s => { el.removeClass(s); }); - el.addClass(statusClassesMap[status]); + + if (status) { + el.addClass(statusClassesMap[status]); + } } function setCheckpoints(div, checkpointsMap) { + + // console.log("setting checkpoints"); for (let i = 0; i < 8; i++) { let checkpoint = i + 1 @@ -36,11 +41,16 @@ $(document).ready(function () { let valEl = row.find("td.checkpoint_val"); let checkpointValue = checkpointsMap[checkpoint]; + // Reset board if nothing to show. + if (!checkpointsMap[0]) { + updateStatus(row); + valEl.text(0); + continue; + } + if (checkpointValue) { updateStatus(row, 1) valEl.text(formatTimestamp(checkpointValue)); - } else if (i === 0) { - return; } else { let now = new Date(); updateStatus(row, 0) @@ -78,8 +88,9 @@ $(document).ready(function () { setBoxShadow(carRightDivId, baseStatus); }); socket.on("send_data", function (data) { - console.log("send_data") + // console.log("send_data") + console.log(data); // console.log(data.left); // console.log(data.right); leftData = data.left;