Add is_manually_nc flag

for items that are NC, but aren't marked with r500 on Neopets.com!
This commit is contained in:
Emi Matchu 2021-02-22 18:05:44 -08:00
parent 614dc0795a
commit c539471afa
2 changed files with 6 additions and 5 deletions

View file

@ -278,8 +278,8 @@ const buildItemByNameLoader = (db, loaders) =>
const itemSearchKindConditions = { const itemSearchKindConditions = {
// NOTE: We assume that items cannot have NC rarity and the PB description, // NOTE: We assume that items cannot have NC rarity and the PB description,
// so we don't bother to filter out PB items in the NC filter, for perf. // so we don't bother to filter out PB items in the NC filter, for perf.
NC: `rarity_index IN (0, 500)`, NC: `rarity_index IN (0, 500) OR is_manually_nc = 1`,
NP: `rarity_index NOT IN (0, 500) AND description NOT LIKE "%This item is part of a deluxe paint brush set!%"`, NP: `rarity_index NOT IN (0, 500) AND is_manually_nc = 0 AND description NOT LIKE "%This item is part of a deluxe paint brush set!%"`,
PB: `description LIKE "%This item is part of a deluxe paint brush set!%"`, PB: `description LIKE "%This item is part of a deluxe paint brush set!%"`,
}; };

View file

@ -217,10 +217,11 @@ const resolvers = {
const item = await itemLoader.load(id); const item = await itemLoader.load(id);
return item.rarityIndex; return item.rarityIndex;
}, },
isNc: async ({ id, rarityIndex }, _, { itemLoader }) => { isNc: async ({ id }, _, { itemLoader }) => {
if (rarityIndex != null) return rarityIndex === 500 || rarityIndex === 0;
const item = await itemLoader.load(id); const item = await itemLoader.load(id);
return item.rarityIndex === 500 || item.rarityIndex === 0; return (
item.rarityIndex === 500 || item.rarityIndex === 0 || item.isManuallyNc
);
}, },
isPb: async ({ id }, _, { itemTranslationLoader }) => { isPb: async ({ id }, _, { itemTranslationLoader }) => {
const translation = await itemTranslationLoader.load(id); const translation = await itemTranslationLoader.load(id);