From 4e271d6e93692b19181866afa6aae26ba063ca01 Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Thu, 30 Nov 2023 12:32:28 +0000 Subject: [PATCH] Fixed bug in summary after selection analysis --- js/ui.js | 13 ++++++++++--- js/worker.js | 3 +-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/js/ui.js b/js/ui.js index 48e522ba..082d4140 100644 --- a/js/ui.js +++ b/js/ui.js @@ -1786,7 +1786,7 @@ function setChartOptions(species, total, rate, results, dataPoints, aggregation, for (const key in results) { hasResults = true; chartOptions.series.push({ - name: `Total for ${aggregation} in ` + key, + name: `Total for ${aggregation.replace('Day', 'Night')} in ` + key, pointInterval: pointInterval[aggregation], pointStart: pointStart, type: 'column', @@ -1815,13 +1815,20 @@ function setChartOptions(species, total, rate, results, dataPoints, aggregation, point.y; }, `${aggregation} ${weekOfYear} (${getDateOfISOWeek(weekOfYear)} - ${getDateOfISOWeek(weekOfYear + 1)})`); } else if (aggregation === 'Day') { - const period = moment(x).format('MMMM Do, YYYY'); + const period = x.toLocaleDateString('en-GB', { + month: 'long', + day: 'numeric', + year: 'numeric', + }); return this.points.reduce(function (s, point) { return s + '
' + point.series.name + ': ' + point.y; }, `${period}`); } else { - const period = moment(x).format('MMM D, ha'); + const period = x.toLocaleDateString('en-GB', { month: 'short', day: 'numeric' }) + + ', ' + + x.toLocaleTimeString('en-US', { hour: 'numeric', minute: 'numeric', hour12: true }); + return this.points.reduce(function (s, point) { return s + '
Count: ' + point.y; diff --git a/js/worker.js b/js/worker.js index 7e132e38..fc4d36f7 100644 --- a/js/worker.js +++ b/js/worker.js @@ -1841,8 +1841,7 @@ const parsePredictions = async (response) => { updateFilesBeingProcessed(response.file) console.log(`File ${file} processed after ${(new Date() - predictionStart) / 1000} seconds: ${filesBeingProcessed.length} files to go`); } - //!STATE.selection && (!DATASET || STATE.increment() === 0) && - getSummary({ interim: true }); + !STATE.selection && (!DATASET || STATE.increment() === 0) && getSummary({ interim: true }); return response.worker }