mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
add end date to more items/categories
This commit is contained in:
@@ -875,7 +875,7 @@ function makeEndDate (checkedDate, matcher) {
|
|||||||
end.date(TYPE_SCHEDULE[matcher.type]);
|
end.date(TYPE_SCHEDULE[matcher.type]);
|
||||||
if (matcher.endMonth !== undefined) {
|
if (matcher.endMonth !== undefined) {
|
||||||
end.month(matcher.endMonth);
|
end.month(matcher.endMonth);
|
||||||
} else if (end.date() <= moment(checkedDate).date()) {
|
} else if (end.date() <= checkedDate) {
|
||||||
end = moment(end).add(1, 'months');
|
end = moment(end).add(1, 'months');
|
||||||
}
|
}
|
||||||
return end.toDate();
|
return end.toDate();
|
||||||
@@ -895,7 +895,7 @@ export function getAllScheduleMatchingGroups (date) {
|
|||||||
cachedScheduleMatchers = {};
|
cachedScheduleMatchers = {};
|
||||||
assembleScheduledMatchers(checkedDate).forEach(matcher => {
|
assembleScheduledMatchers(checkedDate).forEach(matcher => {
|
||||||
if (!cachedScheduleMatchers[matcher.type]) {
|
if (!cachedScheduleMatchers[matcher.type]) {
|
||||||
cachedScheduleMatchers[matcher.type] = makeMatcherClass(date);
|
cachedScheduleMatchers[matcher.type] = makeMatcherClass(checkedDate);
|
||||||
}
|
}
|
||||||
cachedScheduleMatchers[matcher.type].end = makeEndDate(checkedDate, matcher);
|
cachedScheduleMatchers[matcher.type].end = makeEndDate(checkedDate, matcher);
|
||||||
if (matcher.matcher instanceof Function) {
|
if (matcher.matcher instanceof Function) {
|
||||||
|
|||||||
@@ -294,10 +294,11 @@ shops.getQuestShopCategories = function getQuestShopCategories (user, language)
|
|||||||
|
|
||||||
if (type === 'pet' || type === 'hatchingPotion') {
|
if (type === 'pet' || type === 'hatchingPotion') {
|
||||||
const matchers = getScheduleMatchingGroup(`${type}Quests`);
|
const matchers = getScheduleMatchingGroup(`${type}Quests`);
|
||||||
filteredQuests = filteredQuests.filter(quest => matchers.match(quest.key));
|
filteredQuests = filteredQuests.filter(quest => matchers.match(quest.key))
|
||||||
|
.map(quest => getItemInfo(user, 'quests', quest, officialPinnedItems, language, matchers));
|
||||||
}
|
}
|
||||||
|
|
||||||
category.items = filteredQuests.map(quest => getItemInfo(user, 'quests', quest, officialPinnedItems, language));
|
category.items = filteredQuests;
|
||||||
|
|
||||||
categories.push(category);
|
categories.push(category);
|
||||||
});
|
});
|
||||||
@@ -379,7 +380,6 @@ shops.getTimeTravelersCategories = function getTimeTravelersCategories (user, la
|
|||||||
categories.push(category);
|
categories.push(category);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const sets = content.timeTravelerStore(user, new Date());
|
const sets = content.timeTravelerStore(user, new Date());
|
||||||
const availabilityMatchers = getScheduleMatchingGroup('timeTravelers');
|
const availabilityMatchers = getScheduleMatchingGroup('timeTravelers');
|
||||||
for (const setKey of Object.keys(sets)) {
|
for (const setKey of Object.keys(sets)) {
|
||||||
@@ -404,6 +404,7 @@ shops.getTimeTravelersCategories = function getTimeTravelersCategories (user, la
|
|||||||
currency: 'hourglasses',
|
currency: 'hourglasses',
|
||||||
class: `shop_${item.key}`,
|
class: `shop_${item.key}`,
|
||||||
pinKey: `timeTravelers!gear.flat.${item.key}`,
|
pinKey: `timeTravelers!gear.flat.${item.key}`,
|
||||||
|
end: availabilityMatchers.end,
|
||||||
}));
|
}));
|
||||||
if (category.items.length > 0) {
|
if (category.items.length > 0) {
|
||||||
categories.push(category);
|
categories.push(category);
|
||||||
|
|||||||
Reference in New Issue
Block a user