5482a83 add minHistLen as a parameter to preenUserHistory (with a

default value of 7)
This commit is contained in:
Tyler Renelle 2013-11-08 13:57:28 -08:00
parent 761887da18
commit 317f1a9319
2 changed files with 5 additions and 5 deletions

View file

@ -8721,9 +8721,10 @@ if(typeof module != 'undefined' && module.exports){
return newHistory;
};
obj.preenUserHistory = function(user) {
var minHistLen;
minHistLen = 7;
obj.preenUserHistory = function(user, minHistLen) {
if (minHistLen == null) {
minHistLen = 7;
}
_.each(user.habits.concat(user.dailys), function(task) {
var _ref1;
if (((_ref1 = task.history) != null ? _ref1.length : void 0) > minHistLen) {

View file

@ -476,8 +476,7 @@ preenHistory = (history) ->
newHistory
# Registered users with some history
obj.preenUserHistory = (user) ->
minHistLen = 7
obj.preenUserHistory = (user, minHistLen = 7) ->
_.each user.habits.concat(user.dailys), (task) ->
task.history = preenHistory(task.history) if task.history?.length > minHistLen
true