Skip to content

Commit

Permalink
add check for no languages
Browse files Browse the repository at this point in the history
  • Loading branch information
jinkang-0 committed May 1, 2024
1 parent 64b521e commit fa65c34
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/cases/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function Page() {
.filter(
c =>
languagesFilters.size === 0 ||
c.languages.length === 0 ||
c.languages.find(l => languagesFilters.has(l)),
)
.filter(
Expand All @@ -85,6 +86,16 @@ export default function Page() {
return boolToInt(aMissingRemote) - boolToInt(bMissingRemote);
}

// if filtering languages
if (languagesFilters.size !== 0) {
const aMissingLanguages = a.languages.length === 0;
const bMissingLanguages = b.languages.length === 0;
if (aMissingLanguages || bMissingLanguages)
return (
boolToInt(aMissingLanguages) - boolToInt(bMissingLanguages)
);
}

// if filtering agency
if (agencyFilters.size !== 0) {
const aMissingAgency = nullOrUndefined(a.adjudicating_agency);
Expand Down

0 comments on commit fa65c34

Please sign in to comment.