From 372ffd47c71053f5a793b808ce3f2b7f8341e1a5 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Fri, 13 Jan 2023 11:27:55 -0500 Subject: [PATCH] cleaner null check --- helpers/lotOccupancyDB/getWorkOrders.js | 2 +- helpers/lotOccupancyDB/getWorkOrders.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helpers/lotOccupancyDB/getWorkOrders.js b/helpers/lotOccupancyDB/getWorkOrders.js index c4a57019..19751e31 100644 --- a/helpers/lotOccupancyDB/getWorkOrders.js +++ b/helpers/lotOccupancyDB/getWorkOrders.js @@ -46,7 +46,7 @@ function buildWhereClause(filters) { '))'; sqlParameters.push(...lotNameFilters.sqlParameters); } - if (filters.lotOccupancyId) { + if ((filters.lotOccupancyId ?? '') !== '') { sqlWhereClause += ' and w.workOrderId in (select workOrderId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and lotOccupancyId = ?)'; sqlParameters.push(filters.lotOccupancyId); diff --git a/helpers/lotOccupancyDB/getWorkOrders.ts b/helpers/lotOccupancyDB/getWorkOrders.ts index 4be03eb0..c5fe97df 100644 --- a/helpers/lotOccupancyDB/getWorkOrders.ts +++ b/helpers/lotOccupancyDB/getWorkOrders.ts @@ -87,7 +87,7 @@ function buildWhereClause(filters: GetWorkOrdersFilters): { sqlParameters.push(...lotNameFilters.sqlParameters) } - if (filters.lotOccupancyId) { + if ((filters.lotOccupancyId ?? '') !== '') { sqlWhereClause += ' and w.workOrderId in (select workOrderId from WorkOrderLotOccupancies where recordDelete_timeMillis is null and lotOccupancyId = ?)' sqlParameters.push(filters.lotOccupancyId)