tweak effective date filter

used in work order related
deepsource-autofix-76c6eb20
Dan Gowans 2023-02-28 11:50:21 -05:00
parent 0b54cf8d67
commit 61443c1e06
2 changed files with 8 additions and 2 deletions

View File

@ -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 ?? '') !== '') {

View File

@ -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!)