tweak connectedDatabase undefined check

deepsource-autofix-76c6eb20
Dan Gowans 2023-01-18 08:39:29 -05:00
parent 3eb4958f65
commit 7d8a63dfb4
54 changed files with 54 additions and 54 deletions

View File

@ -47,7 +47,7 @@ export function addLotOccupancy(lotOccupancyForm, requestSession, connectedDatab
occupantComment: lotOccupancyForm.occupantComment
}, requestSession, database);
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotOccupancyId;

View File

@ -117,7 +117,7 @@ export function addLotOccupancy(
)
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -27,7 +27,7 @@ export function addLotOccupancyOccupant(lotOccupancyOccupantForm, requestSession
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
.run(lotOccupancyOccupantForm.lotOccupancyId, lotOccupantIndex, lotOccupancyOccupantForm.occupantName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, lotOccupancyOccupantForm.occupantProvince, lotOccupancyOccupantForm.occupantPostalCode, lotOccupancyOccupantForm.occupantPhoneNumber, lotOccupancyOccupantForm.occupantEmailAddress, lotOccupancyOccupantForm.occupantComment ?? '', lotOccupancyOccupantForm.lotOccupantTypeId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotOccupantIndex;

View File

@ -76,7 +76,7 @@ export function addLotOccupancyOccupant(
rightNowMillis
)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -22,7 +22,7 @@ export function addOrUpdateLotField(lotFieldForm, requestSession, connectedDatab
values (?, ?, ?, ?, ?, ?, ?)`)
.run(lotFieldForm.lotId, lotFieldForm.lotTypeFieldId, lotFieldForm.lotFieldValue, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return result.changes > 0;

View File

@ -58,7 +58,7 @@ export function addOrUpdateLotField(
)
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -22,7 +22,7 @@ export function addOrUpdateLotOccupancyField(lotOccupancyFieldForm, requestSessi
values (?, ?, ?, ?, ?, ?, ?)`)
.run(lotOccupancyFieldForm.lotOccupancyId, lotOccupancyFieldForm.occupancyTypeFieldId, lotOccupancyFieldForm.lotOccupancyFieldValue, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return result.changes > 0;

View File

@ -58,7 +58,7 @@ export function addOrUpdateLotOccupancyField(
)
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -33,7 +33,7 @@ export function addWorkOrderLotOccupancy(workOrderLotOccupancyForm, requestSessi
values (?, ?, ?, ?, ?, ?)`)
.run(workOrderLotOccupancyForm.workOrderId, workOrderLotOccupancyForm.lotOccupancyId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return true;

View File

@ -72,7 +72,7 @@ export function addWorkOrderLotOccupancy(
)
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -10,7 +10,7 @@ export function deleteLotField(lotId, lotTypeFieldId, requestSession, connectedD
where lotId = ?
and lotTypeFieldId = ?`)
.run(requestSession.user.userName, rightNowMillis, lotId, lotTypeFieldId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return result.changes > 0;

View File

@ -24,7 +24,7 @@ export function deleteLotField(
)
.run(requestSession.user!.userName, rightNowMillis, lotId, lotTypeFieldId)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -10,7 +10,7 @@ export function deleteLotOccupancyField(lotOccupancyId, occupancyTypeFieldId, re
where lotOccupancyId = ?
and occupancyTypeFieldId = ?`)
.run(requestSession.user.userName, rightNowMillis, lotOccupancyId, occupancyTypeFieldId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return result.changes > 0;

View File

@ -29,7 +29,7 @@ export function deleteLotOccupancyField(
occupancyTypeFieldId
)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -22,7 +22,7 @@ export function getFee(feeId, connectedDatabase) {
where f.recordDelete_timeMillis is null
and f.feeId = ?`)
.get(feeId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return fee;

View File

@ -34,7 +34,7 @@ export function getFee(
)
.get(feeId)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -49,7 +49,7 @@ export function getFees(feeCategoryId, additionalFilters, connectedDatabase) {
expectedOrderNumber += 1;
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return fees;

View File

@ -86,7 +86,7 @@ export function getFees(
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -19,7 +19,7 @@ export function getLotComments(lotId, connectedDatabase) {
and lotId = ?
order by lotCommentDate desc, lotCommentTime desc, lotCommentId desc`)
.all(lotId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotComments;

View File

@ -36,7 +36,7 @@ export function getLotComments(
)
.all(lotId)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -33,7 +33,7 @@ export function getLotFields(lotId, connectedDatabase) {
and f.lotTypeFieldId not in (select lotTypeFieldId from LotFields where lotId = ? and recordDelete_timeMillis is null)
order by lotTypeOrderNumber, f.orderNumber, f.lotTypeField`)
.all(lotId, lotId, lotId, lotId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotFields;

View File

@ -45,7 +45,7 @@ export function getLotFields(
)
.all(lotId, lotId, lotId, lotId)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -112,7 +112,7 @@ export function getLotOccupancies(filters, options, connectedDatabase) {
}
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return {

View File

@ -207,7 +207,7 @@ export function getLotOccupancies(
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -41,7 +41,7 @@ export function getLotOccupancy(lotOccupancyId, connectedDatabase) {
offset: 0
}, database).workOrders;
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotOccupancy;

View File

@ -77,7 +77,7 @@ export function getLotOccupancy(
).workOrders
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -19,7 +19,7 @@ export function getLotOccupancyComments(lotOccupancyId, connectedDatabase) {
and lotOccupancyId = ?
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`)
.all(lotOccupancyId);
if (!connectedDatabase) {
if (connectedDatabase === null) {
database.close();
}
return lotComments;

View File

@ -36,7 +36,7 @@ export function getLotOccupancyComments(
)
.all(lotOccupancyId)
if (!connectedDatabase) {
if (connectedDatabase === null) {
database.close()
}

View File

@ -16,7 +16,7 @@ export function getLotOccupancyFees(lotOccupancyId, connectedDatabase) {
and o.lotOccupancyId = ?
order by o.recordCreate_timeMillis`)
.all(lotOccupancyId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotOccupancyFees;

View File

@ -28,7 +28,7 @@ export function getLotOccupancyFees(
)
.all(lotOccupancyId)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -30,7 +30,7 @@ export function getLotOccupancyFields(lotOccupancyId, connectedDatabase) {
and f.occupancyTypeFieldId not in (select occupancyTypeFieldId from LotOccupancyFields where lotOccupancyId = ? and recordDelete_timeMillis is null)
order by occupancyTypeOrderNumber, f.orderNumber, f.occupancyTypeField`)
.all(lotOccupancyId, lotOccupancyId, lotOccupancyId, lotOccupancyId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotOccupancyFields;

View File

@ -42,7 +42,7 @@ export function getLotOccupancyFields(
)
.all(lotOccupancyId, lotOccupancyId, lotOccupancyId, lotOccupancyId)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -20,7 +20,7 @@ export function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase) {
and o.lotOccupancyId = ?
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`)
.all(lotOccupancyId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotOccupancyOccupants;

View File

@ -32,7 +32,7 @@ export function getLotOccupancyOccupants(
)
.all(lotOccupancyId)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -18,7 +18,7 @@ export function getLotOccupancyTransactions(lotOccupancyId, connectedDatabase) {
and lotOccupancyId = ?
order by transactionDate, transactionTime, transactionIndex`)
.all(lotOccupancyId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotOccupancyTransactions;

View File

@ -36,7 +36,7 @@ export function getLotOccupancyTransactions(
)
.all(lotOccupancyId)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -20,7 +20,7 @@ export function getLotTypeFields(lotTypeId, connectedDatabase) {
}
expectedOrderNumber += 1;
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return lotTypeFields;

View File

@ -40,7 +40,7 @@ export function getLotTypeFields(
expectedOrderNumber += 1
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -92,7 +92,7 @@ export function getLots(filters, options, connectedDatabase) {
count = lots.length;
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return {

View File

@ -154,7 +154,7 @@ export function getLots(
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -17,7 +17,7 @@ export function getNextWorkOrderNumber(connectedDatabase) {
' where userFn_matchesWorkOrderNumberSyntax(workOrderNumber) = 1' +
" order by cast(substr(workOrderNumber, instr(workOrderNumber, '-') + 1) as integer) desc")
.get();
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
let workOrderNumberIndex = 0;

View File

@ -35,7 +35,7 @@ export function getNextWorkOrderNumber(
)
.get()
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -27,7 +27,7 @@ export function getOccupancyTypeFields(occupancyTypeId, connectedDatabase) {
}
expectedOrderNumber += 1;
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return occupancyTypeFields;

View File

@ -49,7 +49,7 @@ export function getOccupancyTypeFields(
expectedOrderNumber += 1
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -33,7 +33,7 @@ export function getOccupancyTypePrints(occupancyTypeId, connectedDatabase) {
}
prints.push(result.printEJS);
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return prints;

View File

@ -59,7 +59,7 @@ export function getOccupancyTypePrints(
prints.push(result.printEJS)
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -51,7 +51,7 @@ function _getWorkOrder(sql, workOrderIdOrWorkOrderNumber, options, connectedData
}, database);
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return workOrder;

View File

@ -95,7 +95,7 @@ function _getWorkOrder(
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -19,7 +19,7 @@ export function getWorkOrderComments(workOrderId, connectedDatabase) {
and workOrderId = ?
order by workOrderCommentDate desc, workOrderCommentTime desc, workOrderCommentId desc`)
.all(workOrderId);
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return workOrderComments;

View File

@ -36,7 +36,7 @@ export function getWorkOrderComments(
)
.all(workOrderId)
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -122,7 +122,7 @@ export function getWorkOrderMilestones(filters, options, connectedDatabase) {
}, database).lotOccupancies;
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return workOrderMilestones;

View File

@ -208,7 +208,7 @@ export function getWorkOrderMilestones(
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}

View File

@ -123,7 +123,7 @@ export function getWorkOrders(filters, options, connectedDatabase) {
}
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close();
}
return {

View File

@ -205,7 +205,7 @@ export function getWorkOrders(
}
}
if (!connectedDatabase) {
if (connectedDatabase === undefined) {
database.close()
}