mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-13 17:52:22 +00:00
fix(admin): reactivity on next hourglass
This commit is contained in:
parent
f364b3c06f
commit
008314676d
1 changed files with 5 additions and 14 deletions
|
|
@ -41,9 +41,6 @@
|
|||
step="1"
|
||||
>
|
||||
</label>
|
||||
<span class="small">
|
||||
Updates Hourglasses and Gem cap automatically. Next Mystic Hourglass updates on save.
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
Months until renewal:
|
||||
|
|
@ -51,7 +48,7 @@
|
|||
</div>
|
||||
<div>
|
||||
Next Mystic Hourglass:
|
||||
<strong>{{ nextHourGlassDate }}</strong>
|
||||
<strong>{{ nextHourglassDate }}</strong>
|
||||
</div>
|
||||
<div class="form-inline">
|
||||
<label>
|
||||
|
|
@ -134,28 +131,23 @@ export default {
|
|||
data () {
|
||||
return {
|
||||
consecutiveMonths: 0,
|
||||
startingHourglasses: 0,
|
||||
expand: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
nextHourGlassDate () {
|
||||
const currentPlanContext = getPlanContext(this.hero, new Date());
|
||||
nextHourglassDate () {
|
||||
const pendingHero = clone(this.hero);
|
||||
pendingHero.purchased.plan.consecutive.count = this.consecutiveMonths;
|
||||
const currentPlanContext = getPlanContext(pendingHero, new Date());
|
||||
|
||||
return currentPlanContext.nextHourglassDate.format('MMMM');
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
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(
|
||||
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
|
||||
> 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 () {
|
||||
this.consecutiveMonths = clone(this.hero.purchased.plan.consecutive.count);
|
||||
this.startingHourglasses = clone(this.hero.purchased.plan.consecutive.trinkets);
|
||||
},
|
||||
methods: {
|
||||
dateFormat (date) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue