sleeplog: only write log if we have something to write

master
Rob Pilling 2024-03-02 16:22:15 +00:00
parent 4c0eccaf67
commit 0d5c39a183
3 changed files with 5 additions and 3 deletions

View File

@ -11,3 +11,4 @@
0.13: Prevent to stay in consecutive sleep if not worn, correct trigger calling, add trigger object itself as argument to the fn function 0.13: Prevent to stay in consecutive sleep if not worn, correct trigger calling, add trigger object itself as argument to the fn function
0.14: Add "Delete all logfiles before" to interface.html, display all logfiles in the interface 0.14: Add "Delete all logfiles before" to interface.html, display all logfiles in the interface
0.15: Issue newline before GB commands (solves issue with console.log and ignored commands) 0.15: Issue newline before GB commands (solves issue with console.log and ignored commands)
0.16: Only write logs if we have a non-empty log to write

View File

@ -169,6 +169,7 @@ exports = {
// check if before this fortnight period // check if before this fortnight period
if (firstDay < thisFirstDay) { if (firstDay < thisFirstDay) {
// write log in seperate file // write log in seperate file
if(log.length > 0)
require("Storage").writeJSON("sleeplog_" + this.msToFn(firstDay) + ".log", log); require("Storage").writeJSON("sleeplog_" + this.msToFn(firstDay) + ".log", log);
// set last day as first // set last day as first
firstDay = lastDay; firstDay = lastDay;

View File

@ -2,7 +2,7 @@
"id":"sleeplog", "id":"sleeplog",
"name":"Sleep Log", "name":"Sleep Log",
"shortName": "SleepLog", "shortName": "SleepLog",
"version": "0.15", "version": "0.16",
"description": "Log and view your sleeping habits. This app is using the built in movement calculation.", "description": "Log and view your sleeping habits. This app is using the built in movement calculation.",
"icon": "app.png", "icon": "app.png",
"type": "app", "type": "app",