deepsource-autofix-76c6eb20
Dan Gowans 2023-01-17 13:26:38 -05:00
parent e5cc63fe87
commit 3eb4958f65
24 changed files with 166 additions and 168 deletions

View File

@ -13,7 +13,8 @@ export function addRecord(recordTable, recordName, orderNumber, requestSession)
const rightNowMillis = Date.now();
const result = database
.prepare(`insert into ${recordTable} (
${recordNameColumns.get(recordTable)}, orderNumber,
${recordNameColumns.get(recordTable)},
orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?)`)

View File

@ -34,7 +34,8 @@ export function addRecord(
const result = database
.prepare(
`insert into ${recordTable} (
${recordNameColumns.get(recordTable)!}, orderNumber,
${recordNameColumns.get(recordTable)!},
orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?)`

View File

@ -6,12 +6,12 @@ export function addWorkOrderComment(workOrderCommentForm, requestSession) {
const rightNow = new Date();
const result = database
.prepare(`insert into WorkOrderComments (
workOrderId,
workOrderCommentDate, workOrderCommentTime,
workOrderComment,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?)`)
workOrderId,
workOrderCommentDate, workOrderCommentTime,
workOrderComment,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?)`)
.run(workOrderCommentForm.workOrderId, dateTimeFunctions.dateToInteger(rightNow), dateTimeFunctions.dateToTimeInteger(rightNow), workOrderCommentForm.workOrderComment, requestSession.user.userName, rightNow.getTime(), requestSession.user.userName, rightNow.getTime());
database.close();
return result.lastInsertRowid;

View File

@ -22,12 +22,12 @@ export function addWorkOrderComment(
const result = database
.prepare(
`insert into WorkOrderComments (
workOrderId,
workOrderCommentDate, workOrderCommentTime,
workOrderComment,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?)`
workOrderId,
workOrderCommentDate, workOrderCommentTime,
workOrderComment,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?)`
)
.run(
workOrderCommentForm.workOrderId,

View File

@ -27,10 +27,10 @@ export function addWorkOrderLot(workOrderLotForm, requestSession) {
else {
database
.prepare(`insert into WorkOrderLots (
workOrderId, lotId,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?)`)
workOrderId, lotId,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?)`)
.run(workOrderLotForm.workOrderId, workOrderLotForm.lotId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
}
database.close();

View File

@ -53,10 +53,10 @@ export function addWorkOrderLot(
database
.prepare(
`insert into WorkOrderLots (
workOrderId, lotId,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?)`
workOrderId, lotId,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?)`
)
.run(
workOrderLotForm.workOrderId,

View File

@ -17,10 +17,10 @@ export function copyLotOccupancy(oldLotOccupancyId, requestSession) {
for (const occupancyField of oldLotOccupancy.lotOccupancyFields ?? []) {
database
.prepare(`insert into LotOccupancyFields (
lotOccupancyId, occupancyTypeFieldId, lotOccupancyFieldValue,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?)`)
lotOccupancyId, occupancyTypeFieldId, lotOccupancyFieldValue,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?)`)
.run(newLotOccupancyId, occupancyField.occupancyTypeFieldId, occupancyField.lotOccupancyFieldValue, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
}
for (const occupant of oldLotOccupancy.lotOccupancyOccupants ?? []) {

View File

@ -39,10 +39,10 @@ export function copyLotOccupancy(
database
.prepare(
`insert into LotOccupancyFields (
lotOccupancyId, occupancyTypeFieldId, lotOccupancyFieldValue,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?)`
lotOccupancyId, occupancyTypeFieldId, lotOccupancyFieldValue,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?)`
)
.run(
newLotOccupancyId,

View File

@ -45,18 +45,18 @@ export function deleteRecord(recordTable, recordId, requestSession) {
const rightNowMillis = Date.now();
const result = database
.prepare(`update ${recordTable}
set recordDelete_userName = ?,
recordDelete_timeMillis = ?
where ${recordIdColumns.get(recordTable)} = ?
and recordDelete_timeMillis is null`)
set recordDelete_userName = ?,
recordDelete_timeMillis = ?
where ${recordIdColumns.get(recordTable)} = ?
and recordDelete_timeMillis is null`)
.run(requestSession.user.userName, rightNowMillis, recordId);
for (const relatedTable of relatedTables.get(recordTable) ?? []) {
database
.prepare(`update ${relatedTable}
set recordDelete_userName = ?,
recordDelete_timeMillis = ?
where ${recordIdColumns.get(recordTable)} = ?
and recordDelete_timeMillis is null`)
set recordDelete_userName = ?,
recordDelete_timeMillis = ?
where ${recordIdColumns.get(recordTable)} = ?
and recordDelete_timeMillis is null`)
.run(requestSession.user.userName, rightNowMillis, recordId);
}
database.close();

View File

@ -79,10 +79,10 @@ export function deleteRecord(
const result = database
.prepare(
`update ${recordTable}
set recordDelete_userName = ?,
recordDelete_timeMillis = ?
where ${recordIdColumns.get(recordTable)!} = ?
and recordDelete_timeMillis is null`
set recordDelete_userName = ?,
recordDelete_timeMillis = ?
where ${recordIdColumns.get(recordTable)!} = ?
and recordDelete_timeMillis is null`
)
.run(requestSession.user!.userName, rightNowMillis, recordId)
@ -90,10 +90,10 @@ export function deleteRecord(
database
.prepare(
`update ${relatedTable}
set recordDelete_userName = ?,
recordDelete_timeMillis = ?
where ${recordIdColumns.get(recordTable)!} = ?
and recordDelete_timeMillis is null`
set recordDelete_userName = ?,
recordDelete_timeMillis = ?
where ${recordIdColumns.get(recordTable)!} = ?
and recordDelete_timeMillis is null`
)
.run(requestSession.user!.userName, rightNowMillis, recordId)
}

View File

@ -83,18 +83,18 @@ export function getLotOccupancies(filters, options, connectedDatabase) {
if (count !== 0) {
lotOccupancies = database
.prepare(`select o.lotOccupancyId,
o.occupancyTypeId, t.occupancyType,
o.lotId, lt.lotType, l.lotName,
l.mapId, m.mapName,
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString
from LotOccupancies o
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
left join Lots l on o.lotId = l.lotId
left join LotTypes lt on l.lotTypeId = lt.lotTypeId
left join Maps m on l.mapId = m.mapId
${sqlWhereClause}
order by o.occupancyStartDate desc, ifnull(o.occupancyEndDate, 99999999) desc, l.lotName, o.lotId, o.lotOccupancyId desc` +
o.occupancyTypeId, t.occupancyType,
o.lotId, lt.lotType, l.lotName,
l.mapId, m.mapName,
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString
from LotOccupancies o
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
left join Lots l on o.lotId = l.lotId
left join LotTypes lt on l.lotTypeId = lt.lotTypeId
left join Maps m on l.mapId = m.mapId
${sqlWhereClause}
order by o.occupancyStartDate desc, ifnull(o.occupancyEndDate, 99999999) desc, l.lotName, o.lotId, o.lotOccupancyId desc` +
(isLimited ? ` limit ${options.limit} offset ${options.offset}` : ''))
.all(sqlParameters);
if (!isLimited) {

View File

@ -167,18 +167,18 @@ export function getLotOccupancies(
lotOccupancies = database
.prepare(
`select o.lotOccupancyId,
o.occupancyTypeId, t.occupancyType,
o.lotId, lt.lotType, l.lotName,
l.mapId, m.mapName,
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString
from LotOccupancies o
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
left join Lots l on o.lotId = l.lotId
left join LotTypes lt on l.lotTypeId = lt.lotTypeId
left join Maps m on l.mapId = m.mapId
${sqlWhereClause}
order by o.occupancyStartDate desc, ifnull(o.occupancyEndDate, 99999999) desc, l.lotName, o.lotId, o.lotOccupancyId desc` +
o.occupancyTypeId, t.occupancyType,
o.lotId, lt.lotType, l.lotName,
l.mapId, m.mapName,
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString
from LotOccupancies o
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
left join Lots l on o.lotId = l.lotId
left join LotTypes lt on l.lotTypeId = lt.lotTypeId
left join Maps m on l.mapId = m.mapId
${sqlWhereClause}
order by o.occupancyStartDate desc, ifnull(o.occupancyEndDate, 99999999) desc, l.lotName, o.lotId, o.lotOccupancyId desc` +
(isLimited ? ` limit ${options.limit} offset ${options.offset}` : '')
)
.all(sqlParameters)

View File

@ -10,14 +10,14 @@ export function getLotOccupancyComments(lotOccupancyId, connectedDatabase) {
database.function('userFn_timeIntegerToString', timeIntegerToString);
const lotComments = database
.prepare(`select lotOccupancyCommentId,
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
lotOccupancyComment,
recordCreate_userName, recordUpdate_userName
from LotOccupancyComments
where recordDelete_timeMillis is null
and lotOccupancyId = ?
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`)
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
lotOccupancyComment,
recordCreate_userName, recordUpdate_userName
from LotOccupancyComments
where recordDelete_timeMillis is null
and lotOccupancyId = ?
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`)
.all(lotOccupancyId);
if (!connectedDatabase) {
database.close();

View File

@ -25,14 +25,14 @@ export function getLotOccupancyComments(
const lotComments = database
.prepare(
`select lotOccupancyCommentId,
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
lotOccupancyComment,
recordCreate_userName, recordUpdate_userName
from LotOccupancyComments
where recordDelete_timeMillis is null
and lotOccupancyId = ?
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
lotOccupancyComment,
recordCreate_userName, recordUpdate_userName
from LotOccupancyComments
where recordDelete_timeMillis is null
and lotOccupancyId = ?
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`
)
.all(lotOccupancyId)

View File

@ -7,18 +7,18 @@ export function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase) {
});
const lotOccupancyOccupants = database
.prepare(`select o.lotOccupancyId, o.lotOccupantIndex,
o.occupantName,
o.occupantAddress1, o.occupantAddress2,
o.occupantCity, o.occupantProvince, o.occupantPostalCode,
o.occupantPhoneNumber, o.occupantEmailAddress,
o.occupantComment,
o.lotOccupantTypeId, t.lotOccupantType,
t.fontAwesomeIconClass
from LotOccupancyOccupants o
left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId
where o.recordDelete_timeMillis is null
and o.lotOccupancyId = ?
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`)
o.occupantName,
o.occupantAddress1, o.occupantAddress2,
o.occupantCity, o.occupantProvince, o.occupantPostalCode,
o.occupantPhoneNumber, o.occupantEmailAddress,
o.occupantComment,
o.lotOccupantTypeId, t.lotOccupantType,
t.fontAwesomeIconClass
from LotOccupancyOccupants o
left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId
where o.recordDelete_timeMillis is null
and o.lotOccupancyId = ?
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`)
.all(lotOccupancyId);
if (!connectedDatabase) {
database.close();

View File

@ -17,18 +17,18 @@ export function getLotOccupancyOccupants(
const lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] = database
.prepare(
`select o.lotOccupancyId, o.lotOccupantIndex,
o.occupantName,
o.occupantAddress1, o.occupantAddress2,
o.occupantCity, o.occupantProvince, o.occupantPostalCode,
o.occupantPhoneNumber, o.occupantEmailAddress,
o.occupantComment,
o.lotOccupantTypeId, t.lotOccupantType,
t.fontAwesomeIconClass
from LotOccupancyOccupants o
left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId
where o.recordDelete_timeMillis is null
and o.lotOccupancyId = ?
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`
o.occupantName,
o.occupantAddress1, o.occupantAddress2,
o.occupantCity, o.occupantProvince, o.occupantPostalCode,
o.occupantPhoneNumber, o.occupantEmailAddress,
o.occupantComment,
o.lotOccupantTypeId, t.lotOccupantType,
t.fontAwesomeIconClass
from LotOccupancyOccupants o
left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId
where o.recordDelete_timeMillis is null
and o.lotOccupancyId = ?
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`
)
.all(lotOccupancyId)

View File

@ -10,13 +10,13 @@ export function getLotOccupancyTransactions(lotOccupancyId, connectedDatabase) {
database.function('userFn_timeIntegerToString', timeIntegerToString);
const lotOccupancyTransactions = database
.prepare(`select lotOccupancyId, transactionIndex,
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
transactionAmount, externalReceiptNumber, transactionNote
from LotOccupancyTransactions
where recordDelete_timeMillis is null
and lotOccupancyId = ?
order by transactionDate, transactionTime, transactionIndex`)
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
transactionAmount, externalReceiptNumber, transactionNote
from LotOccupancyTransactions
where recordDelete_timeMillis is null
and lotOccupancyId = ?
order by transactionDate, transactionTime, transactionIndex`)
.all(lotOccupancyId);
if (!connectedDatabase) {
database.close();

View File

@ -26,13 +26,13 @@ export function getLotOccupancyTransactions(
database
.prepare(
`select lotOccupancyId, transactionIndex,
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
transactionAmount, externalReceiptNumber, transactionNote
from LotOccupancyTransactions
where recordDelete_timeMillis is null
and lotOccupancyId = ?
order by transactionDate, transactionTime, transactionIndex`
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
transactionAmount, externalReceiptNumber, transactionNote
from LotOccupancyTransactions
where recordDelete_timeMillis is null
and lotOccupancyId = ?
order by transactionDate, transactionTime, transactionIndex`
)
.all(lotOccupancyId)

View File

@ -9,19 +9,19 @@ function buildWhereClause(filters) {
const lotNameFilters = getLotNameWhereClause(filters.lotName, filters.lotNameSearchType ?? '', 'l');
sqlWhereClause += lotNameFilters.sqlWhereClause;
sqlParameters.push(...lotNameFilters.sqlParameters);
if (filters.mapId) {
if ((filters.mapId ?? '') !== '') {
sqlWhereClause += ' and l.mapId = ?';
sqlParameters.push(filters.mapId);
}
if (filters.lotTypeId) {
if ((filters.lotTypeId ?? '') !== '') {
sqlWhereClause += ' and l.lotTypeId = ?';
sqlParameters.push(filters.lotTypeId);
}
if (filters.lotStatusId) {
if ((filters.lotStatusId ?? '') !== '') {
sqlWhereClause += ' and l.lotStatusId = ?';
sqlParameters.push(filters.lotStatusId);
}
if (filters.occupancyStatus) {
if ((filters.occupancyStatus ?? '') !== '') {
if (filters.occupancyStatus === 'occupied') {
sqlWhereClause += ' and lotOccupancyCount > 0';
}
@ -30,7 +30,7 @@ function buildWhereClause(filters) {
' and (lotOccupancyCount is null or lotOccupancyCount = 0)';
}
}
if (filters.workOrderId) {
if ((filters.workOrderId ?? '') !== '') {
sqlWhereClause +=
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)';
sqlParameters.push(filters.workOrderId);
@ -50,20 +50,16 @@ export function getLots(filters, options, connectedDatabase) {
let count = 0;
if (options.limit !== -1) {
count = database
.prepare('select count(*) as recordCount' +
' from Lots l' +
(' left join (' +
'select lotId, count(lotOccupancyId) as lotOccupancyCount' +
' from LotOccupancies' +
' where recordDelete_timeMillis is null' +
' and occupancyStartDate <= ' +
currentDate +
' and (occupancyEndDate is null or occupancyEndDate >= ' +
currentDate +
')' +
' group by lotId' +
') o on l.lotId = o.lotId') +
sqlWhereClause)
.prepare(`select count(*) as recordCount
from Lots l
left join (
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
where recordDelete_timeMillis is null
and occupancyStartDate <= ${currentDate}
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate})
group by lotId
) o on l.lotId = o.lotId
${sqlWhereClause}`)
.get(sqlParameters).recordCount;
}
let lots = [];

View File

@ -41,22 +41,22 @@ function buildWhereClause(filters: GetLotsFilters): {
sqlWhereClause += lotNameFilters.sqlWhereClause
sqlParameters.push(...lotNameFilters.sqlParameters)
if (filters.mapId) {
if ((filters.mapId ?? '') !== '') {
sqlWhereClause += ' and l.mapId = ?'
sqlParameters.push(filters.mapId)
}
if (filters.lotTypeId) {
if ((filters.lotTypeId ?? '') !== '') {
sqlWhereClause += ' and l.lotTypeId = ?'
sqlParameters.push(filters.lotTypeId)
}
if (filters.lotStatusId) {
if ((filters.lotStatusId ?? '') !== '') {
sqlWhereClause += ' and l.lotStatusId = ?'
sqlParameters.push(filters.lotStatusId)
}
if (filters.occupancyStatus) {
if ((filters.occupancyStatus ?? '') !== '') {
if (filters.occupancyStatus === 'occupied') {
sqlWhereClause += ' and lotOccupancyCount > 0'
} else if (filters.occupancyStatus === 'unoccupied') {
@ -65,7 +65,7 @@ function buildWhereClause(filters: GetLotsFilters): {
}
}
if (filters.workOrderId) {
if ((filters.workOrderId ?? '') !== '') {
sqlWhereClause +=
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)'
sqlParameters.push(filters.workOrderId)
@ -100,20 +100,16 @@ export function getLots(
if (options.limit !== -1) {
count = database
.prepare(
'select count(*) as recordCount' +
' from Lots l' +
(' left join (' +
'select lotId, count(lotOccupancyId) as lotOccupancyCount' +
' from LotOccupancies' +
' where recordDelete_timeMillis is null' +
' and occupancyStartDate <= ' +
currentDate +
' and (occupancyEndDate is null or occupancyEndDate >= ' +
currentDate +
')' +
' group by lotId' +
') o on l.lotId = o.lotId') +
sqlWhereClause
`select count(*) as recordCount
from Lots l
left join (
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
where recordDelete_timeMillis is null
and occupancyStartDate <= ${currentDate}
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate})
group by lotId
) o on l.lotId = o.lotId
${sqlWhereClause}`
)
.get(sqlParameters).recordCount
}

View File

@ -12,9 +12,9 @@ export function getMaps() {
ifnull(l.lotCount,0) as lotCount
from Maps m
left join (
select mapId, count(lotId) as lotCount
from Lots
where recordDelete_timeMillis is null group by mapId
select mapId, count(lotId) as lotCount
from Lots
where recordDelete_timeMillis is null group by mapId
) l on m.mapId = l.mapId
where m.recordDelete_timeMillis is null order by m.mapName, m.mapId`)
.all();

View File

@ -18,9 +18,9 @@ export function getMaps(): recordTypes.Map[] {
ifnull(l.lotCount,0) as lotCount
from Maps m
left join (
select mapId, count(lotId) as lotCount
from Lots
where recordDelete_timeMillis is null group by mapId
select mapId, count(lotId) as lotCount
from Lots
where recordDelete_timeMillis is null group by mapId
) l on m.mapId = l.mapId
where m.recordDelete_timeMillis is null order by m.mapName, m.mapId`
)

View File

@ -940,9 +940,11 @@ function importFromWorkOrderCSV() {
}
console.timeEnd('importFromWorkOrderCSV');
}
console.log('Started ' + (new Date().toLocaleString()));
console.time('importFromCsv');
purgeTables();
importFromMasterCSV();
importFromPrepaidCSV();
importFromWorkOrderCSV();
console.timeEnd('importFromCsv');
console.log('Finished ' + (new Date().toLocaleString()));

View File

@ -1639,6 +1639,7 @@ function importFromWorkOrderCSV(): void {
console.timeEnd('importFromWorkOrderCSV')
}
console.log('Started ' + (new Date().toLocaleString()))
console.time('importFromCsv')
purgeTables()
@ -1648,3 +1649,4 @@ importFromPrepaidCSV()
importFromWorkOrderCSV()
console.timeEnd('importFromCsv')
console.log('Finished ' + (new Date().toLocaleString()))