Skip to content

Commit

Permalink
when looking for a snooze to cover an alarm, don't worry about alarm …
Browse files Browse the repository at this point in the history
…state since it wouldn't be updated yet
  • Loading branch information
jasoncalabrese committed Jul 9, 2015
1 parent 642e2af commit 9232902
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/notifications.js
Expand Up @@ -122,16 +122,9 @@ function init (env, ctx) {
var byLevel = _.filter(requests.snoozes, function checkSnooze (snooze) {
return snooze.level >= notify.level;
});
var sorted = _.sortBy(byLevel, 'mills');
var longest = _.last(sorted);
var sorted = _.sortBy(byLevel, 'lengthMills');

var alarm = getAlarm(notify.level);

if (longest && Date.now() + longest.lengthMills > alarm.lastAckTime + alarm.silenceTime) {
return longest;
} else {
return null;
}
return _.last(sorted);
};

notifications.requestNotify = function requestNotify (notify) {
Expand Down

0 comments on commit 9232902

Please sign in to comment.