From a1e3d4a89261704c4d123db44f95e79167410b7f Mon Sep 17 00:00:00 2001 From: Nick Breland Date: Sun, 26 Nov 2023 20:35:09 +0000 Subject: [PATCH] wip --- apps/habitbuilder/csv.js | 2 +- apps/habitbuilder/interface.html | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/habitbuilder/csv.js b/apps/habitbuilder/csv.js index f7e81fbdf2..a97256938d 100644 --- a/apps/habitbuilder/csv.js +++ b/apps/habitbuilder/csv.js @@ -3,7 +3,7 @@ const CSV_HEADER = "date,question,response\n"; // Cleans the CSV data by removing duplicate entries document.addEventListener('click', function (event) { if (event.target.id === 'download-csv') { - Util.saveCSV("habitbuilder.data.csv"); + Util.saveCSV("habitbuilder.data.csv", csvData); return; // String representation of the CSV post-cleaning let cleanCsvStr = CSV_HEADER; diff --git a/apps/habitbuilder/interface.html b/apps/habitbuilder/interface.html index 38bb133621..68653ad48f 100644 --- a/apps/habitbuilder/interface.html +++ b/apps/habitbuilder/interface.html @@ -51,8 +51,17 @@

Settings

}); } +let csvData = ''; + +function getData() { + Util.readStorage('habitbuilder.data.csv', data => { + csvData = data.trim(); + }); +} + // Called when app starts function onInit() { + getData(); getSettings(); }