This commit is contained in:
Phillip Thelen
2024-08-09 11:37:44 +02:00
committed by Kalista Payne
parent 6431865688
commit e036742048
10 changed files with 12 additions and 58 deletions
-1
View File
@@ -44,7 +44,6 @@ describe('bug-report', () => {
USER_HOURGLASSES: 0,
USER_ID: userId,
USER_LEVEL: 1,
USER_OFFSET_MONTHS: 0,
USER_PAYMENT_PLATFORM: undefined,
USER_SUBSCRIPTION: undefined,
USER_TIMEZONE_OFFSET: 0,
@@ -715,7 +715,7 @@ describe('Purchasing a group plan for group', () => {
const mysteryItem = { title: 'item' };
const mysteryItems = [mysteryItem];
const consecutive = {
trinkets: 3,
trinkets: 4,
gemCapExtra: 20,
offset: 1,
count: 13,
+1 -2
View File
@@ -13,7 +13,7 @@ import {
import * as worldState from '../../../../../website/server/libs/worldState';
import { TransactionModel } from '../../../../../website/server/models/transaction';
describe.only('payments/index', () => {
describe('payments/index', () => {
let user;
let group;
let data;
@@ -428,7 +428,6 @@ describe.only('payments/index', () => {
expect(user.purchased.plan.customerId).to.eql('customer-id');
expect(user.purchased.plan.dateUpdated).to.exist;
expect(user.purchased.plan.gemsBought).to.eql(0);
expect(user.purchased.plan.perkMonthCount).to.eql(0);
expect(user.purchased.plan.paymentMethod).to.eql('Payment Method');
expect(user.purchased.plan.extraMonths).to.eql(0);
expect(user.purchased.plan.dateTerminated).to.eql(null);
+1 -1
View File
@@ -182,7 +182,7 @@ describe('cron utility functions', () => {
});
});
describe.only('getPlanContext', () => {
describe('getPlanContext', () => {
function baseUserData (count, offset, planId) {
return {
purchased: {
@@ -103,43 +103,12 @@
>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label">
Perk offset months:
</label>
<div class="col-sm-9">
<input
v-model="hero.purchased.plan.consecutive.offset"
class="form-control"
type="number"
min="0"
step="1"
>
</div>
<div>
Next Mystic Hourglass:
<strong>{{ nextHourglassDate }}</strong>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label">
Perk month count:
</label>
<div class="col-sm-9">
<input
v-model="hero.purchased.plan.perkMonthCount"
class="form-control"
type="number"
min="0"
max="2"
step="1"
>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label">
Next Mystic Hourglass:
</label>
<strong class="col-sm-9 col-form-label">{{ nextHourglassDate }}</strong>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label">
<div class="form-inline">
<label>
Mystic Hourglasses:
</label>
<div class="col-sm-9">
@@ -27,13 +27,13 @@
</td>
</tr>
<tr
v-if="group.purchased.plan.consecutive.count || group.purchased.plan.consecutive.offset"
v-if="group.purchased.plan.consecutive.count"
>
<td>
<span class="glyphicon glyphicon-forward"></span>
{{ $t('consecutiveSubscription') }}
<ul class="list-unstyled">
<li>{{ $t('consecutiveMonths') }} {{ group.purchased.plan.consecutive.count + group.purchased.plan.consecutive.offset }}</li> <!-- eslint-disable-line max-len -->
<li>{{ $t('consecutiveMonths') }} {{ group.purchased.plan.consecutive.count }}</li> <!-- eslint-disable-line max-len -->
<li>{{ $t('gemCapExtra') }} {{ group.purchased.plan.consecutive.gemCapExtra }}</li>
<li>{{ $t('mysticHourglasses') }} {{ group.purchased.plan.consecutive.trinkets }}</li>
</ul>
@@ -235,8 +235,7 @@
>
</div>
<div class="number-heavy">
{{ user.purchased.plan.consecutive.count +
user.purchased.plan.consecutive.offset }}
{{ user.purchased.plan.consecutive.count }}
</div>
</div>
<div class="stats-label">
@@ -739,8 +738,7 @@ export default {
return this.user.purchased.plan.customerId === 'group-plan';
},
hasConsecutiveSubscription () {
return Boolean(this.user.purchased.plan.consecutive.count)
|| Boolean(this.user.purchased.plan.consecutive.offset);
return Boolean(this.user.purchased.plan.consecutive.count);
},
purchasedPlanExtraMonthsDetails () {
return {
@@ -288,9 +288,6 @@ api.updateHero = {
if (plan.dateTerminated !== hero.purchased.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
@@ -313,9 +310,6 @@ api.updateHero = {
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
}
}
}
-1
View File
@@ -16,7 +16,6 @@ export async function bugReportLogic (user, userEmail, message, BROWSER_UA, ques
USER_PAYMENT_PLATFORM: user.purchased.plan.paymentMethod,
USER_CUSTOMER_ID: user.purchased.plan.customerId,
USER_CONSECUTIVE_MONTHS: user.purchased.plan.consecutive.count,
USER_OFFSET_MONTHS: user.purchased.plan.consecutive.offset,
USER_HOURGLASSES: user.purchased.plan.consecutive.trinkets,
REPORT_MSG: message,
BROWSER_UA,
@@ -155,10 +155,6 @@ async function prepareSubscriptionValues (data) {
const { plan } = recipient.purchased;
if (isNewSubscription) {
plan.perkMonthCount = 0;
}
if (data.gift || !autoRenews) {
if (plan.customerId && !plan.dateTerminated) { // User has active plan
plan.extraMonths += months;