diff --git a/lib/v2/epicgames/index.js b/lib/v2/epicgames/index.js index 2777c11e2e..34b01a4632 100644 --- a/lib/v2/epicgames/index.js +++ b/lib/v2/epicgames/index.js @@ -24,7 +24,9 @@ module.exports = async (ctx) => { (item) => item.promotions && item.promotions.promotionalOffers && - item.promotions.promotionalOffers[0] && + item.promotions.promotionalOffers.length && + item.promotions.promotionalOffers[0].promotionalOffers[0].discountSetting.discountType === 'PERCENTAGE' && + item.promotions.promotionalOffers[0].promotionalOffers[0].discountSetting.discountPercentage === 0 && dayjs(item.promotions.promotionalOffers[0].promotionalOffers[0].startDate) <= now && dayjs(item.promotions.promotionalOffers[0].promotionalOffers[0].endDate) > now ) @@ -32,15 +34,11 @@ module.exports = async (ctx) => { let link = `${rootUrl}/${locale}/p/`; let contentUrl = `${contentBaseUrl}/products/`; let isBundles = false; - item.categories.some((category) => { - if (category.path === 'bundles') { - link = `${rootUrl}/${locale}/bundles/`; - isBundles = true; - contentUrl = `${contentBaseUrl}/bundles/`; - return true; - } - return false; - }); + if (item.categories.some((category) => category.path === 'bundles')) { + link = `${rootUrl}/${locale}/bundles/`; + isBundles = true; + contentUrl = `${contentBaseUrl}/bundles/`; + } const linkSlug = item.catalogNs.mappings.length > 0 ? item.catalogNs.mappings[0].pageSlug : item.offerMappings.length > 0 ? item.offerMappings[0].pageSlug : item.productSlug ? item.productSlug : item.urlSlug; link += linkSlug; contentUrl += linkSlug; @@ -61,6 +59,7 @@ module.exports = async (ctx) => { } return false; }); + const endDate = dayjs(item.promotions.promotionalOffers[0].promotionalOffers[0].endDate).toISOString(); return { title: item.title, author: item.seller.name, @@ -68,6 +67,7 @@ module.exports = async (ctx) => { description: art(path.join(__dirname, 'templates/description.art'), { description, image, + endDate, }), pubDate: parseDate(item.promotions.promotionalOffers[0].promotionalOffers[0].startDate), }; diff --git a/lib/v2/epicgames/templates/description.art b/lib/v2/epicgames/templates/description.art index 5b42c1b105..02f13056c9 100644 --- a/lib/v2/epicgames/templates/description.art +++ b/lib/v2/epicgames/templates/description.art @@ -1,2 +1,3 @@

{{ description }}

+

Free Now to {{ endDate }}