From 61443c1e069e519e5ddea9a6a3916b9a7c304722 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Tue, 28 Feb 2023 11:50:21 -0500 Subject: [PATCH] tweak effective date filter used in work order related --- helpers/lotOccupancyDB/getLotOccupancies.js | 5 ++++- helpers/lotOccupancyDB/getLotOccupancies.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/helpers/lotOccupancyDB/getLotOccupancies.js b/helpers/lotOccupancyDB/getLotOccupancies.js index 2dace040..15e389c3 100644 --- a/helpers/lotOccupancyDB/getLotOccupancies.js +++ b/helpers/lotOccupancyDB/getLotOccupancies.js @@ -37,7 +37,10 @@ function buildWhereClause(filters) { } if ((filters.occupancyEffectiveDateString ?? '') !== '') { sqlWhereClause += - ' and (o.occupancyStartDate <= ? and (o.occupancyEndDate is null or o.occupancyEndDate >= ?))'; + ` and ( + o.occupancyEndDate is null + or (o.occupancyStartDate <= ? and o.occupancyEndDate >= ?) + )`; sqlParameters.push(dateStringToInteger(filters.occupancyEffectiveDateString), dateStringToInteger(filters.occupancyEffectiveDateString)); } if ((filters.mapId ?? '') !== '') { diff --git a/helpers/lotOccupancyDB/getLotOccupancies.ts b/helpers/lotOccupancyDB/getLotOccupancies.ts index 61cf481d..48e4ea95 100644 --- a/helpers/lotOccupancyDB/getLotOccupancies.ts +++ b/helpers/lotOccupancyDB/getLotOccupancies.ts @@ -98,7 +98,10 @@ function buildWhereClause(filters: GetLotOccupanciesFilters): { if ((filters.occupancyEffectiveDateString ?? '') !== '') { sqlWhereClause += - ' and (o.occupancyStartDate <= ? and (o.occupancyEndDate is null or o.occupancyEndDate >= ?))' + ` and ( + o.occupancyEndDate is null + or (o.occupancyStartDate <= ? and o.occupancyEndDate >= ?) + )` sqlParameters.push( dateStringToInteger(filters.occupancyEffectiveDateString!), dateStringToInteger(filters.occupancyEffectiveDateString!)