This commit is contained in:
Tyler Beckman 2024-04-15 15:32:47 -06:00
parent 2b65c74654
commit fa75cf7172
Signed by untrusted user who does not match committer: Ty
GPG key ID: 2813440C772555A4
2 changed files with 10 additions and 3 deletions

11
cli.ts
View file

@ -34,7 +34,9 @@ for (const row of dom.querySelectorAll("tr")) {
.filter((n) => n.nodeName === "TD") .filter((n) => n.nodeName === "TD")
.map((n) => n.textContent.trim()); .map((n) => n.textContent.trim());
// Skip invalid entries // Skip invalid entries
if (!institution || !location || !entry || !code || entry === "Names TBA") continue; if (!institution || !location || !entry || !code || entry === "Names TBA") {
continue;
}
entries.push({ entries.push({
institution, institution,
@ -104,7 +106,12 @@ const nsdaSearchResults = await Promise
schoolFilterUsed = true; schoolFilterUsed = true;
nsdaLookup = nsdaLookup.filter((ee) => nsdaLookup = nsdaLookup.filter((ee) =>
ee.school_name.toLowerCase().includes(e.institution.toLowerCase()) ee.school_name.replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase().includes(
e.institution.replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase(),
) ||
e.institution.replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase().includes(
ee.school_name.replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase(),
)
); );
} }