Merged in develop

This commit is contained in:
Keith Holliday
2017-06-27 22:23:13 -06:00
897 changed files with 50434 additions and 41464 deletions

View File

@@ -111,7 +111,7 @@ function performSleepTasks (user, tasksByType, now) {
let thatDay = moment(now).subtract({days: 1});
if (shouldDo(thatDay.toDate(), daily, user.preferences) || completed) {
// TODO also untick checklists if the Daily was due on previous missed days, if two or more days were missed at once -- https://github.com/HabitRPG/habitrpg/pull/7218#issuecomment-219256016
// TODO also untick checklists if the Daily was due on previous missed days, if two or more days were missed at once -- https://github.com/HabitRPG/habitica/pull/7218#issuecomment-219256016
if (daily.checklist) {
daily.checklist.forEach(box => box.completed = false);
}
@@ -206,8 +206,11 @@ export function cron (options = {}) {
let perfect = true;
// Reset Gold-to-Gems cap if it's the start of the month
if (user.purchased && user.purchased.plan && !moment(user.purchased.plan.dateUpdated).startOf('month').isSame(moment().startOf('month'))) {
let dateUpdatedFalse = !moment(user.purchased.plan.dateUpdated).startOf('month').isSame(moment().startOf('month')) || !user.purchased.plan.dateUpdated;
if (user.purchased && user.purchased.plan && dateUpdatedFalse) {
user.purchased.plan.gemsBought = 0;
if (!user.purchased.plan.dateUpdated) user.purchased.plan.dateUpdated = moment();
}
if (user.isSubscribed()) {
@@ -395,7 +398,7 @@ export function cron (options = {}) {
// preen user history so that it doesn't become a performance problem
// also for subscribed users but differently
// TODO also do while resting in the inn. Note that later we'll be allowing the value/color of tasks to change while sleeping (https://github.com/HabitRPG/habitrpg/issues/5232), so the code in performSleepTasks() might be best merged back into here for that. Perhaps wait until then to do preen history for sleeping users.
// TODO also do while resting in the inn. Note that later we'll be allowing the value/color of tasks to change while sleeping (https://github.com/HabitRPG/habitica/issues/5232), so the code in performSleepTasks() might be best merged back into here for that. Perhaps wait until then to do preen history for sleeping users.
preenUserHistory(user, tasksByType, user.preferences.timezoneOffset);
if (perfect && atLeastOneDailyDue) {