handle saving a zero fee

deepsource-autofix-76c6eb20
Dan Gowans 2023-01-27 15:55:39 -05:00
parent 50a881a009
commit 3429f07d3f
5 changed files with 13 additions and 9 deletions

View File

@ -20,7 +20,9 @@ export async function updateFee(feeForm, requestSession) {
recordUpdate_timeMillis = ? recordUpdate_timeMillis = ?
where recordDelete_timeMillis is null where recordDelete_timeMillis is null
and feeId = ?`) and feeId = ?`)
.run(feeForm.feeCategoryId, feeForm.feeName, feeForm.feeDescription, feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId, feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId, feeForm.feeAmount ?? undefined, feeForm.feeFunction ?? undefined, feeForm.taxAmount ?? undefined, feeForm.taxPercentage ?? undefined, feeForm.includeQuantity === '' ? 0 : 1, feeForm.quantityUnit, feeForm.isRequired === '' ? 0 : 1, requestSession.user.userName, rightNowMillis, feeForm.feeId); .run(feeForm.feeCategoryId, feeForm.feeName, feeForm.feeDescription, feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId, feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId, feeForm.feeAmount === undefined || feeForm.feeAmount === ''
? 0
: feeForm.feeAmount, feeForm.feeFunction ?? undefined, feeForm.taxAmount ?? undefined, feeForm.taxPercentage ?? undefined, feeForm.includeQuantity === '' ? 0 : 1, feeForm.quantityUnit, feeForm.isRequired === '' ? 0 : 1, requestSession.user.userName, rightNowMillis, feeForm.feeId);
database.release(); database.release();
return result.changes > 0; return result.changes > 0;
} }

View File

@ -52,7 +52,9 @@ export async function updateFee(
feeForm.feeDescription, feeForm.feeDescription,
feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId, feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId,
feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId, feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId,
feeForm.feeAmount ?? undefined, feeForm.feeAmount === undefined || feeForm.feeAmount === ''
? 0
: feeForm.feeAmount,
feeForm.feeFunction ?? undefined, feeForm.feeFunction ?? undefined,
feeForm.taxAmount ?? undefined, feeForm.taxAmount ?? undefined,
feeForm.taxPercentage ?? undefined, feeForm.taxPercentage ?? undefined,

View File

@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
let feeCategories = exports.feeCategories; let feeCategories = exports.feeCategories;
delete exports.feeCategories; delete exports.feeCategories;
function renderFeeCategories() { function renderFeeCategories() {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
if (feeCategories.length === 0) { if (feeCategories.length === 0) {
feeCategoriesContainerElement.innerHTML = `<div class="message is-warning"> feeCategoriesContainerElement.innerHTML = `<div class="message is-warning">
<p class="message-body">There are no available fees.</p> <p class="message-body">There are no available fees.</p>
@ -126,19 +126,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
'<br />' + '<br />' +
'<small>Fee Function</small>' '<small>Fee Function</small>'
: '$' + : '$' +
fee.feeAmount.toFixed(2) + ((_l = fee.feeAmount) !== null && _l !== void 0 ? _l : 0).toFixed(2) +
'<br />' + '<br />' +
'<small>Fee</small>') + '<small>Fee</small>') +
'</div>') + '</div>') +
('<div class="column has-text-centered">' + ('<div class="column has-text-centered">' +
(fee.taxPercentage (fee.taxPercentage
? fee.taxPercentage.toString() + '%' ? fee.taxPercentage.toString() + '%'
: '$' + fee.taxAmount.toFixed(2)) + : '$' + ((_m = fee.taxAmount) !== null && _m !== void 0 ? _m : 0).toFixed(2)) +
'<br /><small>Tax</small>' + '<br /><small>Tax</small>' +
'</div>') + '</div>') +
('<div class="column has-text-centered">' + ('<div class="column has-text-centered">' +
(fee.includeQuantity (fee.includeQuantity
? cityssm.escapeHTML((_l = fee.quantityUnit) !== null && _l !== void 0 ? _l : '') + ? cityssm.escapeHTML((_o = fee.quantityUnit) !== null && _o !== void 0 ? _o : '') +
'<br />' + '<br />' +
'<small>Quantity</small>' '<small>Quantity</small>'
: '') + : '') +

View File

@ -157,14 +157,14 @@ declare const bulmaJS: BulmaJS
'<br />' + '<br />' +
'<small>Fee Function</small>' '<small>Fee Function</small>'
: '$' + : '$' +
fee.feeAmount!.toFixed(2) + (fee.feeAmount ?? 0).toFixed(2) +
'<br />' + '<br />' +
'<small>Fee</small>') + '<small>Fee</small>') +
'</div>') + '</div>') +
('<div class="column has-text-centered">' + ('<div class="column has-text-centered">' +
(fee.taxPercentage (fee.taxPercentage
? fee.taxPercentage.toString() + '%' ? fee.taxPercentage.toString() + '%'
: '$' + fee.taxAmount!.toFixed(2)) + : '$' + (fee.taxAmount ?? 0).toFixed(2)) +
'<br /><small>Tax</small>' + '<br /><small>Tax</small>' +
'</div>') + '</div>') +
('<div class="column has-text-centered">' + ('<div class="column has-text-centered">' +

File diff suppressed because one or more lines are too long