Make sure we handle all isp id in the queried list

This commit is contained in:
nymkappa 2022-11-22 11:58:16 +09:00
parent 7232c4755d
commit 9d5717f30d
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

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