From 412f7bf50b78a3c19fa6dc47c8ee9ab35226f8dc Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Fri, 29 Jun 2012 10:16:02 -0400 Subject: [PATCH] lastCron bug fix (still buggy though) --- src/app/index.coffee | 14 ++++++-------- views/app/index.html | 6 ++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app/index.coffee b/src/app/index.coffee index a264b2738b..fb943ca58b 100644 --- a/src/app/index.coffee +++ b/src/app/index.coffee @@ -100,14 +100,12 @@ get '/', (page, model) -> #TODO: Implement this for cron poormanscron = (model) -> lastCron = model.get('_user.lastCron') - if lastCron - DAY = 1000 * 60 * 60 * 24 - today = new Date() - days_passed = Math.round((today.getTime() - lastCron.getTime()) / DAY) - if days_passed > 0 - endOfDayTally(model) for[]in length:days_passed - lastCron = new Date() - else + lastCron = if lastCron then (new Date(lastCron)) else new Date() + DAY = 1000 * 60 * 60 * 24 + today = new Date() + days_passed = Math.round((today.getTime() - lastCron.getTime()) / DAY) + if days_passed > 0 + endOfDayTally(model) for[]in length:days_passed lastCron = new Date() model.set('_user.lastCron', lastCron) diff --git a/views/app/index.html b/views/app/index.html index a614b9bf81..f46c4c0dce 100644 --- a/views/app/index.html +++ b/views/app/index.html @@ -76,8 +76,10 @@ - - + {#if _user.history.todos} + + + {/}