add end date to seasonal gear in market

This commit is contained in:
Phillip Thelen 2024-05-22 15:47:02 +02:00
parent 2303d5de32
commit 88a0b57335
2 changed files with 18 additions and 1 deletions

View file

@ -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 => {

View file

@ -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