diff --git a/js/ui.js b/js/ui.js index 4d8f0278..e19ccce3 100644 --- a/js/ui.js +++ b/js/ui.js @@ -1613,7 +1613,8 @@ const setUpWorkerMessaging = () => { generateToast({ message: args.message}); break; } - case "results-complete": {onResultsComplete(args); + // Called when last result is returned from a database query + case "database-results-complete": {onResultsComplete(args); hideLoadingSpinner(); break; } @@ -1641,10 +1642,10 @@ const setUpWorkerMessaging = () => { case "progress": {onProgress(args); break; } + // called when an analysis ends, or when the filesbeingprocessed list is empty case "processing-complete": { STATE.analysisDone = true; PREDICTING = false; - DOM.progressDiv.classList.add('d-none'); break; } case 'ready-for-tour':{ @@ -2784,7 +2785,7 @@ function onChartData(args) { } /* - onResultsComplete is called when the last result is sent + onResultsComplete is called when the last result is sent from the database */ function onResultsComplete({active = undefined, select = undefined} = {}){ let table = document.getElementById('resultTableBody'); diff --git a/js/worker.js b/js/worker.js index 422d9460..9bbe25ce 100644 --- a/js/worker.js +++ b/js/worker.js @@ -2095,7 +2095,8 @@ const prepSummaryStatement = (included) => { } if (!filesBeingProcessed.length) { if (!STATE.selection) getSummary(); - //UI.postMessage({event: 'processing-complete'}) + // Need this here in case last file is not sent for analysis (e.g. nocmig mode) + UI.postMessage({event: 'processing-complete'}) } } @@ -2401,7 +2402,7 @@ const prepSummaryStatement = (included) => { } } } - STATE.selection || UI.postMessage({event: 'results-complete', active: active, select: select?.start}); + STATE.selection || UI.postMessage({event: 'database-results-complete', active: active, select: select?.start}); }; // Function to format the CSV export @@ -3125,8 +3126,6 @@ async function setIncludedIDs(lat, lon, week) { if (STATE.included === undefined) STATE.included = {} STATE.included = merge(STATE.included, includedObject); - //UI.postMessage({ event: "results-complete" }); - return STATE.included; })();