Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Aug 17, 2023
1 parent d0eaeb5 commit 2b23622
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bin/wwwProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ function onError(error: ServerError): void {
debug('Requires elevated privileges')
// eslint-disable-next-line n/no-process-exit
process.exit(1)
// break;
// break
}

// eslint-disable-next-line no-fallthrough
case 'EADDRINUSE': {
debug('Port is already in use.')
// eslint-disable-next-line n/no-process-exit
process.exit(1)
// break;
// break
}

// eslint-disable-next-line no-fallthrough
Expand Down
7 changes: 6 additions & 1 deletion database/getEnergyDataFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function getEnergyDataFiles(filters, options) {
sql += ' and f.isFailed = ?';
sqlParameters.push(filters.isFailed ? 1 : 0);
}
if ((filters.searchString ?? '') !== '') {
sql += ' and (instr(f.originalFileName, ?) > 0)';
sqlParameters.push(filters.searchString);
}
sql += ` group by ${groupByColumnNames}
order by f.recordUpdate_timeMillis desc`;
if (options.limit !== -1) {
Expand Down Expand Up @@ -72,7 +76,8 @@ export function getFailedEnergyDataFiles() {
}
export function getProcessedEnergyDataFiles(searchString) {
return getEnergyDataFiles({
isProcessed: true
isProcessed: true,
searchString
}, {
includeAssetDetails: true,
includeSystemFileAndFolder: false,
Expand Down
9 changes: 8 additions & 1 deletion database/getEnergyDataFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface GetEnergyDataFilesFilters {
isPending?: boolean
isProcessed?: boolean
isFailed?: boolean
searchString?: string
}

interface GetEnergyDataFilesOptions {
Expand Down Expand Up @@ -69,6 +70,11 @@ function getEnergyDataFiles(
sqlParameters.push(filters.isFailed ? 1 : 0)
}

if ((filters.searchString ?? '') !== '') {
sql += ' and (instr(f.originalFileName, ?) > 0)'
sqlParameters.push(filters.searchString)
}

sql += ` group by ${groupByColumnNames}
order by f.recordUpdate_timeMillis desc`

Expand Down Expand Up @@ -129,7 +135,8 @@ export function getProcessedEnergyDataFiles(
): EnergyDataFile[] {
return getEnergyDataFiles(
{
isProcessed: true
isProcessed: true,
searchString
},
{
includeAssetDetails: true,
Expand Down
2 changes: 1 addition & 1 deletion public-typescript/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
parserClassSelectElement.append(optionElement);
}
},
onshown(modalElement, closeModalFunction) {
onshown(modalElement) {
var _a;
bulmaJS.toggleHtmlClipped();
Emile.initializeAssetSelector({
Expand Down
2 changes: 1 addition & 1 deletion public-typescript/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ declare const cityssm: cityssmGlobal
parserClassSelectElement.append(optionElement)
}
},
onshown(modalElement, closeModalFunction) {
onshown(modalElement) {
bulmaJS.toggleHtmlClipped()

Emile.initializeAssetSelector({
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/data.min.js

Large diffs are not rendered by default.

0 comments on commit 2b23622

Please sign in to comment.