Created
April 9, 2015 10:42
-
-
Save dtzitz/f34bd884767cb3fb6d5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
averagescore: function(){ | |
scores = Scores.find({kid : this._id},{sort: {point_date:-1} }) | |
//iterate over the score/date hash to implement date logic | |
i = 0 | |
points_total = 0 | |
scores.forEach(function (scores) { | |
// ... | |
i++ | |
eval_date = moment(scores.point_date, "MM DD YYYY") | |
end_of_week = moment().isoWeekday(6) | |
start_of_week = moment().isoWeekday(1) | |
//some_bool = eval_date < end_of_week | |
some_iterator = 0 | |
if (eval_date < end_of_week && eval_date >= start_of_week){ | |
some_iterator +=1 | |
console.log(some_iterator) | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment