small passed.cron bug fix

This commit is contained in:
Tyler Renelle 2012-08-06 10:15:58 -04:00
parent 0f013d2ef3
commit 2e3e99e366
2 changed files with 2 additions and 9 deletions

View file

@ -117,7 +117,7 @@ ready(function(model) {
tour.start();
model.on('set', '_user.tasks.*.completed', function(i, completed, previous, isLocal, passed) {
var direction, from, fromIds, task, to, toIds, _ref3, _ref4;
if (passed.cron != null) {
if ((passed != null) && passed.cron) {
return;
}
direction = function() {
@ -299,12 +299,6 @@ ready(function(model) {
model.set('_user.lastCron', today);
_results = [];
for (n = _k = 1; 1 <= daysPassed ? _k <= daysPassed : _k >= daysPassed; n = 1 <= daysPassed ? ++_k : --_k) {
console.log({
today: today,
lastCron: lastCron,
daysPassed: daysPassed,
n: n
}, "[debug] Cron (" + today + ", " + n + ")");
_results.push(scoring.tally(model));
}
return _results;

View file

@ -102,7 +102,7 @@ ready (model) ->
tour.start()
model.on 'set', '_user.tasks.*.completed', (i, completed, previous, isLocal, passed) ->
return if passed.cron? # Don't do this stuff on cron
return if passed? && passed.cron # Don't do this stuff on cron
direction = () ->
return 'up' if completed==true and previous == false
return 'down' if completed==false and previous == true
@ -244,7 +244,6 @@ ready (model) ->
if daysPassed > 0
model.set('_user.lastCron', today) # reset cron
for n in [1..daysPassed]
console.log {today: today, lastCron: lastCron, daysPassed: daysPassed, n:n}, "[debug] Cron (#{today}, #{n})"
scoring.tally(model)
poormanscron() # Run once on refresh
setInterval (-> # Then run once every hour