mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
allow users to trigger "missed day" manually from Restore modal
This commit is contained in:
21
migrations/20131105_remove_history_ids.js
Normal file
21
migrations/20131105_remove_history_ids.js
Normal file
@@ -0,0 +1,21 @@
|
||||
function deleteId(h){
|
||||
delete h._id;
|
||||
}
|
||||
|
||||
db.users.find({},{habits:1,dailys:1,history:1}).forEach(function(user){
|
||||
if (user.history) {
|
||||
_.each(['todos','exp'], function(type){
|
||||
if (user.history[type]) {
|
||||
_.each(user.history.exp, deleteId);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
user.history = {exp:[],todos:[]};
|
||||
}
|
||||
|
||||
_.each(['habits', 'dailys'], function(type){
|
||||
_.each(user[type].history, deleteId);
|
||||
});
|
||||
|
||||
db.users.update({_id:user._id}, {$set:{history: user.history, habits: user.habits, dailys: user.dailys}});
|
||||
});
|
||||
@@ -46,7 +46,7 @@ habitrpg.controller("FooterCtrl", ['$scope', '$rootScope', 'User', '$http', 'Not
|
||||
*/
|
||||
$scope.addMissedDay = function(){
|
||||
var dayBefore = moment(User.user.lastCron).subtract('days', 1).toDate();
|
||||
User.set({lastCron: dayBefore});
|
||||
User.set('lastCron', dayBefore);
|
||||
Notification.text('-1 day, remember to refresh');
|
||||
}
|
||||
$scope.addTenGems = function(){
|
||||
|
||||
@@ -46,6 +46,8 @@ div(ng-controller='SettingsCtrl')
|
||||
.option-group.option-medium
|
||||
input.option-content(type='number', data-for='achievements.streak', ng-model='restoreValues.achievements.streak')
|
||||
span.input-suffix 21-Day Streak
|
||||
h3 Other
|
||||
a.btn.btn-small.btn-warning(ng-controller='FooterCtrl', ng-click='addMissedDay()') Trigger New Day
|
||||
.modal-footer
|
||||
button.btn.btn-primary(ng-click='restore()') Save & Close
|
||||
|
||||
|
||||
Reference in New Issue
Block a user