Fixed generating offers in data generator (#19495)
no issue The data generator created an offer for the free product. This caused an error in admin UI because it couldn't find the tier for the offer. This fixes the issue in both the data generator and the admin UI.
This commit is contained in:
parent
42e7f4f307
commit
bc79293594
@ -36,12 +36,18 @@ export default class MembersController extends Controller {
|
||||
const tier = this.tiers.find((p) => {
|
||||
return p.id === offer.tier.id;
|
||||
});
|
||||
if (!tier) {
|
||||
return false;
|
||||
}
|
||||
const price = offer.cadence === 'month' ? tier.monthlyPrice : tier.yearlyPrice;
|
||||
return !!tier && tier.active && offer.status === this.type && !!price;
|
||||
}).map((offer) => {
|
||||
const tier = this.tiers.find((p) => {
|
||||
return p.id === offer.tier.id;
|
||||
});
|
||||
if (!tier) {
|
||||
return offer;
|
||||
}
|
||||
const price = offer.cadence === 'month' ? tier.monthlyPrice : tier.yearlyPrice;
|
||||
offer.finalCurrency = offer.currency || tier.currency;
|
||||
offer.originalPrice = price;
|
||||
|
@ -14,7 +14,7 @@ class OffersImporter extends TableImporter {
|
||||
}
|
||||
|
||||
async import(quantity = this.defaultQuantity) {
|
||||
this.products = await this.transaction.select('id', 'currency').from('products');
|
||||
this.products = await this.transaction.select('id', 'currency').from('products').where('type', 'paid');
|
||||
this.names = ['Black Friday', 'Free Trial'];
|
||||
this.count = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user