diff --git a/apps/sleeplogalarm/ChangeLog b/apps/sleeplogalarm/ChangeLog index 0030c8783..48d9a161d 100644 --- a/apps/sleeplogalarm/ChangeLog +++ b/apps/sleeplogalarm/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! -0.02: Add "from Consec."-setting \ No newline at end of file +0.02: Add "from Consec."-setting +0.03: Correct how to ignore last triggered alarm \ No newline at end of file diff --git a/apps/sleeplogalarm/lib.js b/apps/sleeplogalarm/lib.js index 71210f98b..aaa97feed 100644 --- a/apps/sleeplogalarm/lib.js +++ b/apps/sleeplogalarm/lib.js @@ -8,13 +8,13 @@ function getNextAlarm(allAlarms, fo, withId) { return a; }); // return next active alarms in range, filter for - // active, not timer, not own alarm, - // after from, before to, includes msg - // not lastTime, not lastDay + // active && not timer && not own alarm && + // after from && before to && includes msg && + // lastDate not today || after lastTime return allAlarms.filter( a => a.on && !a.timer && a.id !== "sleeplog" && a.t >= fo.from && a.t < fo.to && (!fo.msg || a.msg.includes(fo.msg)) && - fo.lastTime !== a.t && fo.lastDay !== a.last + fo.lastDate !== new Date().getDate() || a.t > fo.lastTime ).map(a => { // add time to alarm a.tTo = sched.getTimeToAlarm(a); return a; @@ -58,7 +58,7 @@ exports = { to: settings.filter_to * 36E5, msg: settings.filter_msg, lastTime: settings.lastTime, - lastDay: settings.lastDay + lastDate: settings.lastDate }).t; // abort if no alarm time could be found inside range @@ -95,7 +95,7 @@ exports = { to: settings.filter_to * 36E5, msg: settings.filter_msg, lastTime: settings.lastTime, - lastDay: settings.lastDay + lastDate: settings.lastDate }, settings.disableOnAlarm); // return if no alarm is found @@ -133,7 +133,7 @@ exports = { // save time of alarm and this day to prevent triggering for the same alarm again settings.lastTime = alarm.t; - settings.lastDay = now.getDay(); + settings.lastDate = now.getDay(); require("Storage").writeJSON("sleeplogalarm.settings.json", settings); // write changes diff --git a/apps/sleeplogalarm/metadata.json b/apps/sleeplogalarm/metadata.json index 1a37ffcbf..813f0fe18 100644 --- a/apps/sleeplogalarm/metadata.json +++ b/apps/sleeplogalarm/metadata.json @@ -2,7 +2,7 @@ "id":"sleeplogalarm", "name":"Sleep Log Alarm", "shortName": "SleepLogAlarm", - "version": "0.02", + "version": "0.03", "description": "Enhance your morning and let your alarms wake you up when you are in light sleep.", "icon": "app.png", "type": "widget",