Implements a 'releasedOn' flag and marks challenges less than 30 days old as NEW https://www.dropbox.com/s/43un2a908ldktpl/Screenshot%202015-11-01%2017.06.53.png

This commit is contained in:
terakilobyte
2015-11-01 17:26:26 -08:00
parent 1f61c4be02
commit af30d4d56e
3 changed files with 12 additions and 0 deletions

View File

@@ -537,6 +537,11 @@ module.exports = function(app) {
if (completedChallenges.indexOf(challenge.id) !== -1) {
challenge.completed = true;
}
if (typeof(challenge.releasedOn) !== 'undefined'
&& moment(challenge.releasedOn, 'MMM MMMM DD, YYYY').diff(moment(),
'days') >= -30) {
challenge.markNew = true;
}
return challenge;
})
// group challenges by block | returns a stream of observables