- Perk offset months:
-
{{ hero.purchased.plan.consecutive.offset }}
+
+
Perk month count:
diff --git a/website/common/script/cron.js b/website/common/script/cron.js
index 5b827240af..f138da4daa 100644
--- a/website/common/script/cron.js
+++ b/website/common/script/cron.js
@@ -290,7 +290,7 @@ export function getPlanContext (user, now) {
const planMonths = subscriptionBlocks[plan.planId] ? subscriptionBlocks[plan.planId].months : 1;
let monthsTillNextHourglass;
if (planMonths > 1) {
- monthsTillNextHourglass = plan.consecutive.offset + 1;
+ monthsTillNextHourglass = Number(plan.consecutive.offset) + 1;
} else {
monthsTillNextHourglass = 3 - plan.perkMonthCount;
}
diff --git a/website/server/controllers/api-v3/hall.js b/website/server/controllers/api-v3/hall.js
index e9e4f03ee1..d5386f7f55 100644
--- a/website/server/controllers/api-v3/hall.js
+++ b/website/server/controllers/api-v3/hall.js
@@ -275,15 +275,25 @@ api.updateHero = {
}
if (updateData.purchased && updateData.purchased.plan) {
- if (updateData.purchased.plan.gemsBought) {
- hero.purchased.plan.gemsBought = updateData.purchased.plan.gemsBought;
+ const { plan } = updateData.purchased;
+ if (plan.gemsBought) {
+ hero.purchased.plan.gemsBought = plan.gemsBought;
}
- if (updateData.purchased.plan.perkMonthCount) {
- hero.purchased.plan.perkMonthCount = updateData.purchased.plan.perkMonthCount;
+ if (plan.dateCreated) {
+ hero.purchased.plan.dateCreated = plan.dateCreated;
}
- if (updateData.purchased.plan.consecutive) {
- if (updateData.purchased.plan.consecutive.trinkets) {
- const changedHourglassTrinkets = updateData.purchased.plan.consecutive.trinkets
+ if (plan.dateCurrentTypeCreated) {
+ hero.purchased.plan.dateCurrentTypeCreated = plan.dateCurrentTypeCreated;
+ }
+ if (plan.dateTerminated) {
+ hero.purchased.plan.dateTerminated = plan.dateTerminated;
+ }
+ if (plan.perkMonthCount) {
+ hero.purchased.plan.perkMonthCount = plan.perkMonthCount;
+ }
+ if (plan.consecutive) {
+ if (plan.consecutive.trinkets) {
+ const changedHourglassTrinkets = plan.consecutive.trinkets
- hero.purchased.plan.consecutive.trinkets;
if (changedHourglassTrinkets !== 0) {
@@ -293,13 +303,16 @@ api.updateHero = {
);
}
- hero.purchased.plan.consecutive.trinkets = updateData.purchased.plan.consecutive.trinkets;
+ hero.purchased.plan.consecutive.trinkets = plan.consecutive.trinkets;
}
- if (updateData.purchased.plan.consecutive.gemCapExtra) {
- hero.purchased.plan.consecutive.gemCapExtra = updateData.purchased.plan.consecutive.gemCapExtra; // eslint-disable-line max-len
+ if (plan.consecutive.gemCapExtra) {
+ hero.purchased.plan.consecutive.gemCapExtra = plan.consecutive.gemCapExtra; // eslint-disable-line max-len
}
- if (updateData.purchased.plan.consecutive.count) {
- hero.purchased.plan.consecutive.count = updateData.purchased.plan.consecutive.count; // eslint-disable-line max-len
+ if (plan.consecutive.count) {
+ hero.purchased.plan.consecutive.count = plan.consecutive.count; // eslint-disable-line max-len
+ }
+ if (plan.consecutive.offset) {
+ hero.purchased.plan.consecutive.offset = plan.consecutive.offset; // eslint-disable-line max-len
}
}
}