mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
[#1532] add better validation on preferences.dayStart, and a migration to
cleanup corrupt ones
This commit is contained in:
5
migrations/20131126_clean_dayStart.js
Normal file
5
migrations/20131126_clean_dayStart.js
Normal file
@@ -0,0 +1,5 @@
|
||||
db.users.find({'preferences.dayStart':{$exists:1}},{'preferences.dayStart':1}).forEach(function(user){
|
||||
var dayStart = +user.preferences.dayStart;
|
||||
dayStart = (_.isNaN(dayStart) || dayStart < 0 || dayStart > 24) ? 0 : dayStart;
|
||||
db.users.update({_id:user._id}, {$set:{'preferences.dayStart':dayStart}});
|
||||
});
|
||||
Reference in New Issue
Block a user