mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 13:17:24 +01:00
fix(admin): reactivity on next hourglass
This commit is contained in:
@@ -41,9 +41,6 @@
|
|||||||
step="1"
|
step="1"
|
||||||
>
|
>
|
||||||
</label>
|
</label>
|
||||||
<span class="small">
|
|
||||||
Updates Hourglasses and Gem cap automatically. Next Mystic Hourglass updates on save.
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
Months until renewal:
|
Months until renewal:
|
||||||
@@ -51,7 +48,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
Next Mystic Hourglass:
|
Next Mystic Hourglass:
|
||||||
<strong>{{ nextHourGlassDate }}</strong>
|
<strong>{{ nextHourglassDate }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
<label>
|
<label>
|
||||||
@@ -134,28 +131,23 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
consecutiveMonths: 0,
|
consecutiveMonths: 0,
|
||||||
startingHourglasses: 0,
|
|
||||||
expand: false,
|
expand: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
nextHourGlassDate () {
|
nextHourglassDate () {
|
||||||
const currentPlanContext = getPlanContext(this.hero, new Date());
|
const pendingHero = clone(this.hero);
|
||||||
|
pendingHero.purchased.plan.consecutive.count = this.consecutiveMonths;
|
||||||
|
const currentPlanContext = getPlanContext(pendingHero, new Date());
|
||||||
|
|
||||||
return currentPlanContext.nextHourglassDate.format('MMMM');
|
return currentPlanContext.nextHourglassDate.format('MMMM');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
consecutiveMonths () {
|
consecutiveMonths () {
|
||||||
const startingMonths = this.hero.purchased.plan.consecutive.count;
|
|
||||||
const monthsAdded = Math.max(0, this.consecutiveMonths - startingMonths);
|
|
||||||
this.hero.purchased.plan.consecutive.gemCapExtra = Math.min(
|
this.hero.purchased.plan.consecutive.gemCapExtra = Math.min(
|
||||||
Math.floor(this.consecutiveMonths / 3) * 5, 25,
|
Math.floor(this.consecutiveMonths / 3) * 5, 25,
|
||||||
);
|
);
|
||||||
if (monthsAdded >= 0) {
|
|
||||||
this.hero.purchased.plan.consecutive.trinkets = this.startingHourglasses
|
|
||||||
+ Math.floor(monthsAdded / 3);
|
|
||||||
}
|
|
||||||
if (this.hero.purchased.plan.gemsBought
|
if (this.hero.purchased.plan.gemsBought
|
||||||
> this.hero.purchased.plan.consecutive.gemCapExtra + 25) {
|
> this.hero.purchased.plan.consecutive.gemCapExtra + 25) {
|
||||||
this.hero.purchased.plan.gemsBought = this.hero.purchased.plan.consecutive.gemCapExtra + 25;
|
this.hero.purchased.plan.gemsBought = this.hero.purchased.plan.consecutive.gemCapExtra + 25;
|
||||||
@@ -164,7 +156,6 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.consecutiveMonths = clone(this.hero.purchased.plan.consecutive.count);
|
this.consecutiveMonths = clone(this.hero.purchased.plan.consecutive.count);
|
||||||
this.startingHourglasses = clone(this.hero.purchased.plan.consecutive.trinkets);
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
dateFormat (date) {
|
dateFormat (date) {
|
||||||
|
|||||||
Reference in New Issue
Block a user