fix: Correct set cron debug function

This commit is contained in:
Blade Barringer
2016-05-14 22:30:32 -05:00
parent 3b8ce8451b
commit bc58bd97bb
2 changed files with 17 additions and 4 deletions

View File

@@ -78,12 +78,10 @@ function($scope, $rootScope, User, $http, Notification, ApiUrl, Social) {
}); });
}; };
//@TODO: Route?
$scope.addMissedDay = function(numberOfDays){ $scope.addMissedDay = function(numberOfDays){
if (!confirm("Are you sure you want to reset the day by " + numberOfDays + " day(s)?")) return; if (!confirm("Are you sure you want to reset the day by " + numberOfDays + " day(s)?")) return;
var dayBefore = moment(User.user.lastCron).subtract(numberOfDays, 'days').toDate();
User.set({'lastCron': dayBefore}); User.setCron(numberOfDays);
Notification.text('-' + numberOfDays + ' day(s), remember to refresh');
}; };
$scope.addTenGems = function(){ $scope.addTenGems = function(){

View File

@@ -244,6 +244,21 @@ angular.module('habitrpg')
}) })
}, },
setCron: function (numberOfDays) {
var date = moment(user.lastCron).subtract(numberOfDays, 'days').toDate();
$http({
method: "POST",
url: 'api/v3/debug/update-user',
data: {
lastCron: date
}
})
.then(function (response) {
Notification.text('-' + numberOfDays + ' day(s), remember to refresh');
});
},
clearNewMessages: function () { clearNewMessages: function () {
callOpsFunctionAndRequest('markPmsRead', 'mark-pms-read', "POST"); callOpsFunctionAndRequest('markPmsRead', 'mark-pms-read', "POST");
}, },