From 439c3db81415d3e2c60b62b31f9784587c187e37 Mon Sep 17 00:00:00 2001 From: Elfreda Kwawu Date: Tue, 16 Apr 2024 17:34:26 -0400 Subject: [PATCH] added console logging --- apps/phystrax/interface.html | 45 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/apps/phystrax/interface.html b/apps/phystrax/interface.html index cf5b9e535..d9007967f 100644 --- a/apps/phystrax/interface.html +++ b/apps/phystrax/interface.html @@ -10,32 +10,33 @@ var dataElement = document.getElementById("data"); function getHeartRateData() { - Util.showModal("Loading..."); - dataElement.innerHTML = ""; - Puck.eval('require("Storage").list(/heart_rate_data\\.csv\\x01/)', files => { - if (files.length == 0) { + Util.showModal("Loading..."); + dataElement.innerHTML = ""; + Puck.eval('require("Storage").list(/heart_rate_data\\.csv\\x01/)', files => { + console.log("Files found:", files); // Add this line to check files + if (files.length == 0) { dataElement.innerHTML = "

No heart rate data found

"; - } else { + } else { files.forEach(fn => { - fn = fn.slice(0, -1); - var link = document.createElement("a"); - link.setAttribute("href", "#"); - link.textContent = fn; - link.addEventListener("click", function() { - Util.showModal("Downloading..."); - Util.readStorageFile(fn, function(data) { - Util.saveCSV(fn.slice(0, -4), data); - console.log("Downloaded file path:", fn); // Print file path to console - Util.hideModal(); + fn = fn.slice(0, -1); + var link = document.createElement("a"); + link.setAttribute("href", "#"); + link.textContent = fn; + link.addEventListener("click", function() { + Util.showModal("Downloading..."); + Util.readStorageFile(fn, function(data) { + Util.saveCSV(fn.slice(0, -4), data); + console.log("Downloaded file path:", fn); // Print file path to console + Util.hideModal(); + }); }); - }); - dataElement.appendChild(link); - dataElement.appendChild(document.createElement("br")); + dataElement.appendChild(link); + dataElement.appendChild(document.createElement("br")); }); - } - Util.hideModal(); - }); - } + } + Util.hideModal(); + }); +} function deleteHeartRateData() { Util.showModal("Deleting...");