mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
some more comments in preen_users, 7 days
This commit is contained in:
parent
7133295dbe
commit
0dac392b57
1 changed files with 6 additions and 1 deletions
|
|
@ -19,13 +19,18 @@ var registered = {
|
|||
|
||||
var today = +(new Date);
|
||||
|
||||
// isValidDate = (d) ->
|
||||
// return false if Object::toString.call(d) isnt "[object Date]"
|
||||
// not isNaN(d.getTime())
|
||||
|
||||
|
||||
db.users.find(un_registered).forEach(function(user) {
|
||||
var diff, lastCron;
|
||||
if (!user) return;
|
||||
if (!!user.lastCron) {
|
||||
lastCron = new Date(user.lastCron);
|
||||
diff = Math.abs(moment(today).startOf('day').diff(moment(lastCron).startOf('day'), "days"));
|
||||
if (diff > 10) {
|
||||
if (diff > 7) {
|
||||
return db.users.remove({_id:user._id});
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue