From 88a0b5733520b3df11a7a3505e78d4ee92820242 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Wed, 22 May 2024 15:47:02 +0200 Subject: [PATCH] add end date to seasonal gear in market --- test/common/libs/shops.test.js | 10 ++++++++++ website/common/script/libs/shops.js | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/test/common/libs/shops.test.js b/test/common/libs/shops.test.js index 4be18bd683..a4caf542e4 100644 --- a/test/common/libs/shops.test.js +++ b/test/common/libs/shops.test.js @@ -150,6 +150,16 @@ describe('shops', () => { expect(rogueItems.length, 'Rogue seasonal gear').to.eql(4); }); + + it('seasonal gear contains end date', () => { + const categories = shared.shops.getMarketGearCategories(user); + categories.forEach(category => { + category.items.filter(x => x.key.indexOf('spring2024') !== -1).forEach(item => { + expect(item.end, item.key).to.exist; + }); + }); + }); + it('only shows gear for the current season', () => { const categories = shared.shops.getMarketGearCategories(user); categories.forEach(category => { diff --git a/website/common/script/libs/shops.js b/website/common/script/libs/shops.js index 1089582903..9faa4d1bf9 100644 --- a/website/common/script/libs/shops.js +++ b/website/common/script/libs/shops.js @@ -148,6 +148,8 @@ shops.getMarketGearCategories = function getMarketGear (user, language) { const officialPinnedItems = getOfficialPinnedItems(user); const { pinnedSets } = seasonalShopConfig(); + const gearMatcher = getScheduleMatchingGroup('seasonalGear'); + for (const classType of content.classes) { const category = { identifier: classType, @@ -164,7 +166,12 @@ shops.getMarketGearCategories = function getMarketGear (user, language) { return false; }); - category.items = map(result, e => getItemInfo(user, 'marketGear', e, officialPinnedItems)); + category.items = map(result, e => { + if (e.set === pinnedSets[e.specialClass]) { + return getItemInfo(user, 'marketGear', e, officialPinnedItems, language, gearMatcher); + } + return getItemInfo(user, 'marketGear', e, officialPinnedItems); + }); const specialGear = filter(content.gear.flat, gear => user.items.gear.owned[gear.key] === false && gear.specialClass === classType