use math.floor, not math.round, when computing daysPassed on cron

This commit is contained in:
Tyler Renelle 2012-07-11 14:37:47 -04:00
parent 4c1a04442d
commit 48f26edfb7
2 changed files with 2 additions and 2 deletions

View file

@ -515,7 +515,7 @@ ready(function(model) {
lastCron = lastCron ? new Date(lastCron) : new Date();
DAY = 1000 * 60 * 60 * 24;
today = new Date();
daysPassed = Math.round((today.getTime() - lastCron.getTime()) / DAY);
daysPassed = Math.floor((today.getTime() - lastCron.getTime()) / DAY);
if (daysPassed > 0) {
_(daysPassed).times(function() {
return endOfDayTally();

View file

@ -389,7 +389,7 @@ ready (model) ->
lastCron = if lastCron then (new Date(lastCron)) else new Date()
DAY = 1000 * 60 * 60 * 24
today = new Date()
daysPassed = Math.round((today.getTime() - lastCron.getTime()) / DAY)
daysPassed = Math.floor((today.getTime() - lastCron.getTime()) / DAY)
if daysPassed > 0
_(daysPassed).times ->
endOfDayTally()