diff --git a/ghost/admin/app/controllers/offers.js b/ghost/admin/app/controllers/offers.js index 9da62411f4..62927f710b 100644 --- a/ghost/admin/app/controllers/offers.js +++ b/ghost/admin/app/controllers/offers.js @@ -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; diff --git a/ghost/data-generator/lib/importers/OffersImporter.js b/ghost/data-generator/lib/importers/OffersImporter.js index 989734a882..e72c021cbe 100644 --- a/ghost/data-generator/lib/importers/OffersImporter.js +++ b/ghost/data-generator/lib/importers/OffersImporter.js @@ -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;