oops, fix isNc and stop loading items early!
This commit is contained in:
parent
3c4354d14b
commit
ac12f6bb55
2 changed files with 10 additions and 11 deletions
|
@ -182,8 +182,8 @@ const resolvers = {
|
||||||
return item.rarityIndex;
|
return item.rarityIndex;
|
||||||
},
|
},
|
||||||
isNc: async ({ id, rarityIndex }, _, { itemLoader }) => {
|
isNc: async ({ id, rarityIndex }, _, { itemLoader }) => {
|
||||||
if (rarityIndex) return rarityIndex === 500 || rarityIndex === 0;
|
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;
|
||||||
},
|
},
|
||||||
appearanceOn: async (
|
appearanceOn: async (
|
||||||
|
@ -370,9 +370,8 @@ const resolvers = {
|
||||||
}));
|
}));
|
||||||
return allPairs;
|
return allPairs;
|
||||||
},
|
},
|
||||||
items: async (_, { ids }, { itemLoader }) => {
|
items: (_, { ids }) => {
|
||||||
const items = await itemLoader.loadMany(ids);
|
return ids.map(id => ({ id }));
|
||||||
return items;
|
|
||||||
},
|
},
|
||||||
itemSearch: async (_, { query }, { itemSearchLoader }) => {
|
itemSearch: async (_, { query }, { itemSearchLoader }) => {
|
||||||
const items = await itemSearchLoader.load(query.trim());
|
const items = await itemSearchLoader.load(query.trim());
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe("Item", () => {
|
||||||
expect(getDbCalls()).toMatchInlineSnapshot(`
|
expect(getDbCalls()).toMatchInlineSnapshot(`
|
||||||
Array [
|
Array [
|
||||||
Array [
|
Array [
|
||||||
"SELECT * FROM items WHERE id IN (?,?,?,?)",
|
"SELECT * FROM item_translations WHERE item_id IN (?,?,?,?) AND locale = \\"en\\"",
|
||||||
Array [
|
Array [
|
||||||
"38913",
|
"38913",
|
||||||
"38911",
|
"38911",
|
||||||
|
@ -32,7 +32,7 @@ describe("Item", () => {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
Array [
|
Array [
|
||||||
"SELECT * FROM item_translations WHERE item_id IN (?,?,?,?) AND locale = \\"en\\"",
|
"SELECT * FROM items WHERE id IN (?,?,?,?)",
|
||||||
Array [
|
Array [
|
||||||
"38913",
|
"38913",
|
||||||
"38911",
|
"38911",
|
||||||
|
@ -78,7 +78,7 @@ describe("Item", () => {
|
||||||
expect(getDbCalls()).toMatchInlineSnapshot(`
|
expect(getDbCalls()).toMatchInlineSnapshot(`
|
||||||
Array [
|
Array [
|
||||||
Array [
|
Array [
|
||||||
"SELECT * FROM items WHERE id IN (?,?,?)",
|
"SELECT * FROM item_translations WHERE item_id IN (?,?,?) AND locale = \\"en\\"",
|
||||||
Array [
|
Array [
|
||||||
"38912",
|
"38912",
|
||||||
"38911",
|
"38911",
|
||||||
|
@ -86,7 +86,7 @@ describe("Item", () => {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
Array [
|
Array [
|
||||||
"SELECT * FROM item_translations WHERE item_id IN (?,?,?) AND locale = \\"en\\"",
|
"SELECT * FROM items WHERE id IN (?,?,?)",
|
||||||
Array [
|
Array [
|
||||||
"38912",
|
"38912",
|
||||||
"38911",
|
"38911",
|
||||||
|
@ -173,13 +173,13 @@ describe("Item", () => {
|
||||||
expect(getDbCalls()).toMatchInlineSnapshot(`
|
expect(getDbCalls()).toMatchInlineSnapshot(`
|
||||||
Array [
|
Array [
|
||||||
Array [
|
Array [
|
||||||
"SELECT * FROM items WHERE id IN (?)",
|
"SELECT * FROM item_translations WHERE item_id IN (?) AND locale = \\"en\\"",
|
||||||
Array [
|
Array [
|
||||||
"42829",
|
"42829",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
Array [
|
Array [
|
||||||
"SELECT * FROM item_translations WHERE item_id IN (?) AND locale = \\"en\\"",
|
"SELECT * FROM items WHERE id IN (?)",
|
||||||
Array [
|
Array [
|
||||||
"42829",
|
"42829",
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue