linting
parent
e5cc63fe87
commit
3eb4958f65
|
|
@ -13,7 +13,8 @@ export function addRecord(recordTable, recordName, orderNumber, requestSession)
|
||||||
const rightNowMillis = Date.now();
|
const rightNowMillis = Date.now();
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`insert into ${recordTable} (
|
.prepare(`insert into ${recordTable} (
|
||||||
${recordNameColumns.get(recordTable)}, orderNumber,
|
${recordNameColumns.get(recordTable)},
|
||||||
|
orderNumber,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?)`)
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ export function addRecord(
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(
|
.prepare(
|
||||||
`insert into ${recordTable} (
|
`insert into ${recordTable} (
|
||||||
${recordNameColumns.get(recordTable)!}, orderNumber,
|
${recordNameColumns.get(recordTable)!},
|
||||||
|
orderNumber,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?)`
|
values (?, ?, ?, ?, ?, ?)`
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,19 @@ function buildWhereClause(filters) {
|
||||||
const lotNameFilters = getLotNameWhereClause(filters.lotName, filters.lotNameSearchType ?? '', 'l');
|
const lotNameFilters = getLotNameWhereClause(filters.lotName, filters.lotNameSearchType ?? '', 'l');
|
||||||
sqlWhereClause += lotNameFilters.sqlWhereClause;
|
sqlWhereClause += lotNameFilters.sqlWhereClause;
|
||||||
sqlParameters.push(...lotNameFilters.sqlParameters);
|
sqlParameters.push(...lotNameFilters.sqlParameters);
|
||||||
if (filters.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?';
|
sqlWhereClause += ' and l.mapId = ?';
|
||||||
sqlParameters.push(filters.mapId);
|
sqlParameters.push(filters.mapId);
|
||||||
}
|
}
|
||||||
if (filters.lotTypeId) {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotTypeId = ?';
|
sqlWhereClause += ' and l.lotTypeId = ?';
|
||||||
sqlParameters.push(filters.lotTypeId);
|
sqlParameters.push(filters.lotTypeId);
|
||||||
}
|
}
|
||||||
if (filters.lotStatusId) {
|
if ((filters.lotStatusId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotStatusId = ?';
|
sqlWhereClause += ' and l.lotStatusId = ?';
|
||||||
sqlParameters.push(filters.lotStatusId);
|
sqlParameters.push(filters.lotStatusId);
|
||||||
}
|
}
|
||||||
if (filters.occupancyStatus) {
|
if ((filters.occupancyStatus ?? '') !== '') {
|
||||||
if (filters.occupancyStatus === 'occupied') {
|
if (filters.occupancyStatus === 'occupied') {
|
||||||
sqlWhereClause += ' and lotOccupancyCount > 0';
|
sqlWhereClause += ' and lotOccupancyCount > 0';
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ function buildWhereClause(filters) {
|
||||||
' and (lotOccupancyCount is null or lotOccupancyCount = 0)';
|
' and (lotOccupancyCount is null or lotOccupancyCount = 0)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (filters.workOrderId) {
|
if ((filters.workOrderId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)';
|
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)';
|
||||||
sqlParameters.push(filters.workOrderId);
|
sqlParameters.push(filters.workOrderId);
|
||||||
|
|
@ -50,20 +50,16 @@ export function getLots(filters, options, connectedDatabase) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
if (options.limit !== -1) {
|
if (options.limit !== -1) {
|
||||||
count = database
|
count = database
|
||||||
.prepare('select count(*) as recordCount' +
|
.prepare(`select count(*) as recordCount
|
||||||
' from Lots l' +
|
from Lots l
|
||||||
(' left join (' +
|
left join (
|
||||||
'select lotId, count(lotOccupancyId) as lotOccupancyCount' +
|
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
|
||||||
' from LotOccupancies' +
|
where recordDelete_timeMillis is null
|
||||||
' where recordDelete_timeMillis is null' +
|
and occupancyStartDate <= ${currentDate}
|
||||||
' and occupancyStartDate <= ' +
|
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate})
|
||||||
currentDate +
|
group by lotId
|
||||||
' and (occupancyEndDate is null or occupancyEndDate >= ' +
|
) o on l.lotId = o.lotId
|
||||||
currentDate +
|
${sqlWhereClause}`)
|
||||||
')' +
|
|
||||||
' group by lotId' +
|
|
||||||
') o on l.lotId = o.lotId') +
|
|
||||||
sqlWhereClause)
|
|
||||||
.get(sqlParameters).recordCount;
|
.get(sqlParameters).recordCount;
|
||||||
}
|
}
|
||||||
let lots = [];
|
let lots = [];
|
||||||
|
|
|
||||||
|
|
@ -41,22 +41,22 @@ function buildWhereClause(filters: GetLotsFilters): {
|
||||||
sqlWhereClause += lotNameFilters.sqlWhereClause
|
sqlWhereClause += lotNameFilters.sqlWhereClause
|
||||||
sqlParameters.push(...lotNameFilters.sqlParameters)
|
sqlParameters.push(...lotNameFilters.sqlParameters)
|
||||||
|
|
||||||
if (filters.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?'
|
sqlWhereClause += ' and l.mapId = ?'
|
||||||
sqlParameters.push(filters.mapId)
|
sqlParameters.push(filters.mapId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.lotTypeId) {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotTypeId = ?'
|
sqlWhereClause += ' and l.lotTypeId = ?'
|
||||||
sqlParameters.push(filters.lotTypeId)
|
sqlParameters.push(filters.lotTypeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.lotStatusId) {
|
if ((filters.lotStatusId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotStatusId = ?'
|
sqlWhereClause += ' and l.lotStatusId = ?'
|
||||||
sqlParameters.push(filters.lotStatusId)
|
sqlParameters.push(filters.lotStatusId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.occupancyStatus) {
|
if ((filters.occupancyStatus ?? '') !== '') {
|
||||||
if (filters.occupancyStatus === 'occupied') {
|
if (filters.occupancyStatus === 'occupied') {
|
||||||
sqlWhereClause += ' and lotOccupancyCount > 0'
|
sqlWhereClause += ' and lotOccupancyCount > 0'
|
||||||
} else if (filters.occupancyStatus === 'unoccupied') {
|
} else if (filters.occupancyStatus === 'unoccupied') {
|
||||||
|
|
@ -65,7 +65,7 @@ function buildWhereClause(filters: GetLotsFilters): {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.workOrderId) {
|
if ((filters.workOrderId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)'
|
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)'
|
||||||
sqlParameters.push(filters.workOrderId)
|
sqlParameters.push(filters.workOrderId)
|
||||||
|
|
@ -100,20 +100,16 @@ export function getLots(
|
||||||
if (options.limit !== -1) {
|
if (options.limit !== -1) {
|
||||||
count = database
|
count = database
|
||||||
.prepare(
|
.prepare(
|
||||||
'select count(*) as recordCount' +
|
`select count(*) as recordCount
|
||||||
' from Lots l' +
|
from Lots l
|
||||||
(' left join (' +
|
left join (
|
||||||
'select lotId, count(lotOccupancyId) as lotOccupancyCount' +
|
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
|
||||||
' from LotOccupancies' +
|
where recordDelete_timeMillis is null
|
||||||
' where recordDelete_timeMillis is null' +
|
and occupancyStartDate <= ${currentDate}
|
||||||
' and occupancyStartDate <= ' +
|
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate})
|
||||||
currentDate +
|
group by lotId
|
||||||
' and (occupancyEndDate is null or occupancyEndDate >= ' +
|
) o on l.lotId = o.lotId
|
||||||
currentDate +
|
${sqlWhereClause}`
|
||||||
')' +
|
|
||||||
' group by lotId' +
|
|
||||||
') o on l.lotId = o.lotId') +
|
|
||||||
sqlWhereClause
|
|
||||||
)
|
)
|
||||||
.get(sqlParameters).recordCount
|
.get(sqlParameters).recordCount
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -940,9 +940,11 @@ function importFromWorkOrderCSV() {
|
||||||
}
|
}
|
||||||
console.timeEnd('importFromWorkOrderCSV');
|
console.timeEnd('importFromWorkOrderCSV');
|
||||||
}
|
}
|
||||||
|
console.log('Started ' + (new Date().toLocaleString()));
|
||||||
console.time('importFromCsv');
|
console.time('importFromCsv');
|
||||||
purgeTables();
|
purgeTables();
|
||||||
importFromMasterCSV();
|
importFromMasterCSV();
|
||||||
importFromPrepaidCSV();
|
importFromPrepaidCSV();
|
||||||
importFromWorkOrderCSV();
|
importFromWorkOrderCSV();
|
||||||
console.timeEnd('importFromCsv');
|
console.timeEnd('importFromCsv');
|
||||||
|
console.log('Finished ' + (new Date().toLocaleString()));
|
||||||
|
|
|
||||||
|
|
@ -1639,6 +1639,7 @@ function importFromWorkOrderCSV(): void {
|
||||||
console.timeEnd('importFromWorkOrderCSV')
|
console.timeEnd('importFromWorkOrderCSV')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('Started ' + (new Date().toLocaleString()))
|
||||||
console.time('importFromCsv')
|
console.time('importFromCsv')
|
||||||
|
|
||||||
purgeTables()
|
purgeTables()
|
||||||
|
|
@ -1648,3 +1649,4 @@ importFromPrepaidCSV()
|
||||||
importFromWorkOrderCSV()
|
importFromWorkOrderCSV()
|
||||||
|
|
||||||
console.timeEnd('importFromCsv')
|
console.timeEnd('importFromCsv')
|
||||||
|
console.log('Finished ' + (new Date().toLocaleString()))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue