From 1797567a374f3cb07b96869765aea845eb6b9521 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Tue, 1 Nov 2022 15:08:14 -0400 Subject: [PATCH] linting --- handlers/lots-get/new.js | 1 + handlers/lots-get/new.ts | 1 + helpers/functions.lotOccupancy.js | 2 +- helpers/functions.lotOccupancy.ts | 2 +- helpers/lotOccupancyDB/addWorkOrderLotOccupancy.ts | 5 +---- types/recordTypes.d.ts | 2 +- types/recordTypes.ts | 2 +- views/lot-edit.ejs | 2 +- 8 files changed, 8 insertions(+), 9 deletions(-) diff --git a/handlers/lots-get/new.js b/handlers/lots-get/new.js index d0baa9c5..1c2c1234 100644 --- a/handlers/lots-get/new.js +++ b/handlers/lots-get/new.js @@ -3,6 +3,7 @@ import { getMaps } from "../../helpers/lotOccupancyDB/getMaps.js"; import * as cacheFunctions from "../../helpers/functions.cache.js"; export const handler = (request, response) => { const lot = { + lotId: -1, lotOccupancies: [] }; const maps = getMaps(); diff --git a/handlers/lots-get/new.ts b/handlers/lots-get/new.ts index 7592e302..03a0d909 100644 --- a/handlers/lots-get/new.ts +++ b/handlers/lots-get/new.ts @@ -9,6 +9,7 @@ import * as recordTypes from "../../types/recordTypes"; export const handler: RequestHandler = (request, response) => { const lot: recordTypes.Lot = { + lotId: -1, lotOccupancies: [] }; diff --git a/helpers/functions.lotOccupancy.js b/helpers/functions.lotOccupancy.js index 2e7f1f56..dedcc65a 100644 --- a/helpers/functions.lotOccupancy.js +++ b/helpers/functions.lotOccupancy.js @@ -26,7 +26,7 @@ export const getFeesByFeeCategory = (lotOccupancy, feeCategory, feeCategoryConta }; export const getTransactionTotal = (lotOccupancy) => { let transactionTotal = 0; - for (const transaction of lotOccupancy.lotOccupancyTransactions) { + for (const transaction of (lotOccupancy.lotOccupancyTransactions || [])) { transactionTotal += transaction.transactionAmount; } return transactionTotal; diff --git a/helpers/functions.lotOccupancy.ts b/helpers/functions.lotOccupancy.ts index ff822de9..2b7e82ff 100644 --- a/helpers/functions.lotOccupancy.ts +++ b/helpers/functions.lotOccupancy.ts @@ -51,7 +51,7 @@ export const getFeesByFeeCategory = ( export const getTransactionTotal = (lotOccupancy: recordTypes.LotOccupancy) => { let transactionTotal = 0; - for (const transaction of lotOccupancy.lotOccupancyTransactions) { + for (const transaction of (lotOccupancy.lotOccupancyTransactions || [])) { transactionTotal += transaction.transactionAmount; } diff --git a/helpers/lotOccupancyDB/addWorkOrderLotOccupancy.ts b/helpers/lotOccupancyDB/addWorkOrderLotOccupancy.ts index 34ccfe84..a7b9b40f 100644 --- a/helpers/lotOccupancyDB/addWorkOrderLotOccupancy.ts +++ b/helpers/lotOccupancyDB/addWorkOrderLotOccupancy.ts @@ -24,10 +24,7 @@ export const addWorkOrderLotOccupancy = ( " where workOrderId = ?" + " and lotOccupancyId = ?" ) - .get( - workOrderLotOccupancyForm.workOrderId, - workOrderLotOccupancyForm.lotOccupancyId - ); + .get(workOrderLotOccupancyForm.workOrderId, workOrderLotOccupancyForm.lotOccupancyId); if (row) { if (row.recordDelete_timeMillis) { diff --git a/types/recordTypes.d.ts b/types/recordTypes.d.ts index fd580446..ee15392a 100644 --- a/types/recordTypes.d.ts +++ b/types/recordTypes.d.ts @@ -49,7 +49,7 @@ export interface LotStatus extends Record { orderNumber?: number; } export interface Lot extends Record { - lotId?: number; + lotId: number; lotName?: string; lotTypeId?: number; lotType?: string; diff --git a/types/recordTypes.ts b/types/recordTypes.ts index 1cd0ce38..d55ae71a 100644 --- a/types/recordTypes.ts +++ b/types/recordTypes.ts @@ -66,7 +66,7 @@ export interface LotStatus extends Record { } export interface Lot extends Record { - lotId?: number; + lotId: number; lotName?: string; lotTypeId?: number; diff --git a/views/lot-edit.ejs b/views/lot-edit.ejs index 411831c4..eea7fa05 100644 --- a/views/lot-edit.ejs +++ b/views/lot-edit.ejs @@ -37,7 +37,7 @@
- + " />