From 9d5717f30de14b2aefe6e3091a6321600b35043a Mon Sep 17 00:00:00 2001 From: nymkappa Date: Tue, 22 Nov 2022 11:58:16 +0900 Subject: [PATCH] Make sure we handle all isp id in the queried list --- backend/src/api/explorer/nodes.api.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/backend/src/api/explorer/nodes.api.ts b/backend/src/api/explorer/nodes.api.ts index 4d49b1d67..f7b283213 100644 --- a/backend/src/api/explorer/nodes.api.ts +++ b/backend/src/api/explorer/nodes.api.ts @@ -524,15 +524,20 @@ class NodesApi { ORDER BY short_id DESC `; - const [rows]: any = await DB.query(query, [ISPId.split(','), ISPId.split(',')]); + const IPSIds = ISPId.split(','); + const [rows]: any = await DB.query(query, [IPSIds, IPSIds]); const nodes = {}; - const intIspId = parseInt(ISPId); + const intISPIds: number[] = []; + for (const ispId of IPSIds) { + intISPIds.push(parseInt(ispId, 10)); + } + for (const channel of rows) { - if (channel.isp1ID === intIspId) { + if (intISPIds.includes(channel.isp1ID)) { nodes[channel.node1PublicKey] = true; } - if (channel.isp2ID === intIspId) { + if (intISPIds.includes(channel.isp2ID)) { nodes[channel.node2PublicKey] = true; } }