Skip to content

Commit

Permalink
fix(search): error when no substance match
Browse files Browse the repository at this point in the history
Signed-off-by: Maud Royer <hello@maudroyer.fr>
  • Loading branch information
jillro committed Sep 6, 2024
1 parent 57a3856 commit c6a7c23
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/app/rechercher/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ async function getSpecialites(specialitesId: string[], substancesId: string[]) {
.selectFrom("Specialite")
.leftJoin("Composant", "Specialite.SpecId", "Composant.SpecId")
.where(({ eb }) =>
eb.or([
eb("Specialite.SpecId", "in", specialitesId),
eb("Composant.NomId", "in", substancesId),
]),
substancesId.length
? eb.or([
eb("Specialite.SpecId", "in", specialitesId),
eb("Composant.NomId", "in", substancesId),
])
: eb("Specialite.SpecId", "in", specialitesId),
)
.where("Specialite.SpecId", "in", liste_CIS_MVP)
.selectAll("Specialite")
Expand Down

0 comments on commit c6a7c23

Please sign in to comment.