remove poormanscron() from refresh for now, only in setInterval

This commit is contained in:
Tyler Renelle
2012-08-06 12:34:54 -04:00
parent a341ff9763
commit 6d204fb08c
4 changed files with 16 additions and 17 deletions
+3 -6
View File
@@ -290,21 +290,18 @@ ready(function(model) {
return model.set('_items.weapon', content.items.weapon[1]);
};
exports.poormanscron = poormanscron = function() {
var daysPassed, lastCron, n, today, _k, _results;
var daysPassed, lastCron, n, today, _k;
today = new Date();
model.setNull('_user.lastCron', today);
lastCron = model.get('_user.lastCron');
daysPassed = helpers.daysBetween(lastCron, today);
if (daysPassed > 0) {
model.set('_user.lastCron', today);
_results = [];
for (n = _k = 1; 1 <= daysPassed ? _k <= daysPassed : _k >= daysPassed; n = 1 <= daysPassed ? ++_k : --_k) {
_results.push(scoring.tally(model));
scoring.tally(model);
}
return _results;
return model.set('_user.lastCron', today);
}
};
poormanscron();
setInterval((function() {
return poormanscron();
}), 3600000);
+4 -4
View File
@@ -1,5 +1,5 @@
// Generated by CoffeeScript 1.3.3
var content, expModifier, hpModifier, score, tally, updateStats;
var content, expModifier, hpModifier, updateStats;
content = require('./content');
@@ -55,7 +55,7 @@ updateStats = function(user, stats) {
}
};
module.exports.score = score = function(spec) {
module.exports.score = function(spec) {
var adjustvalue, cron, delta, direction, exp, hp, lvl, money, sign, task, type, user, value, _ref, _ref1;
if (spec == null) {
spec = {
@@ -108,7 +108,7 @@ module.exports.score = score = function(spec) {
return delta;
};
module.exports.tally = tally = function(model) {
module.exports.tally = function(model) {
var absVal, completed, expTally, key, lvl, task, todoTally, type, user, value, _ref;
user = model.at('_user');
todoTally = 0;
@@ -117,7 +117,7 @@ module.exports.tally = tally = function(model) {
_ref = [task.get('type'), task.get('value'), task.get('completed')], type = _ref[0], value = _ref[1], completed = _ref[2];
if (type === 'todo' || type === 'daily') {
if (!completed) {
score({
module.exports.score({
user: user,
task: task,
direction: 'down',