Skip to content

Commit

Permalink
Merge pull request #122 from bcgov/frontend-duplicate-ips
Browse files Browse the repository at this point in the history
remove duplicate ips in frontend webpage
  • Loading branch information
mgtennant authored Nov 17, 2023
2 parents 2efa671 + a2b6090 commit 67e6f1a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions frontend/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ export function nfrInterestedParties(
}[]
) {
const result: { clientName: string; address: string }[] = [];
const seenCombinations = new Set<string>();

for (const client of tenantAddr) {
let clientName: string;
if (client.legalName) {
Expand All @@ -247,11 +249,19 @@ export function nfrInterestedParties(
.filter(Boolean)
.join(" ");
}
result.push({
clientName,
address: getMailingAddress(client),
});

const address = getMailingAddress(client);
const combination = `${clientName}-${address}`;

if (!seenCombinations.has(combination)) {
result.push({
clientName,
address,
});
seenCombinations.add(combination);
}
}

return result;
}

Expand Down

0 comments on commit 67e6f1a

Please sign in to comment.