Fix beers with ibu null not being shown
This commit is contained in:
@@ -47,7 +47,7 @@ export async function findDrinksFromSearch(searchParams: URLSearchParams) : Prom
|
||||
// Beers
|
||||
if(searchParams.has("drink", "Beer") || noDrinkSelected){
|
||||
|
||||
let where = Object.assign({}, whereBase, {style: {}, AND: <any>[]});
|
||||
let where = Object.assign({}, whereBase, {style: {}, OR: <any>[]});
|
||||
|
||||
// Beer styles
|
||||
if(searchParams.has("beerstyle")){
|
||||
@@ -62,8 +62,14 @@ export async function findDrinksFromSearch(searchParams: URLSearchParams) : Prom
|
||||
if(searchParams.has("max-ibu")){
|
||||
maxibu = Number(searchParams.get("max-ibu"));
|
||||
}
|
||||
where.AND.push({ibu: {gte: minibu}});
|
||||
where.AND.push({ibu: {lte: maxibu}});
|
||||
|
||||
where.OR.push({AND: <any>[]})
|
||||
where.OR[0].AND.push({ibu: {gte: minibu}});
|
||||
where.OR[0].AND.push({ibu: {lte: maxibu}});
|
||||
|
||||
if(minibu == 0){
|
||||
where.OR.push({ibu: null});
|
||||
}
|
||||
|
||||
result = result.concat(await dbe.beer.findMany({
|
||||
include: {style: true, manufacturer: true, containers: {include: {section: true, checkouts: true}}},
|
||||
|
||||
Reference in New Issue
Block a user