From 4e1ed0a0c29b83614d8e6cf203d1c40a8c6c7493 Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Sun, 25 Feb 2024 16:10:12 +0000 Subject: [PATCH] Fixed nocturnal filter when using location settings. --- Help/settings.html | 7 +++++++ js/listWorker.js | 7 +++---- js/ui.js | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Help/settings.html b/Help/settings.html index 0de13f7d..6355764c 100644 --- a/Help/settings.html +++ b/Help/settings.html @@ -105,6 +105,13 @@ Larger values lead to faster processing, especially on long files. + + Enable analysis completion notifications + + This is useful if you would like to run Chirpity analysis in the background, + or with the window minimised. A system alert will notify you when the analysis completes. + +
Location
diff --git a/js/listWorker.js b/js/listWorker.js index 6f90d869..cbcfd2cb 100644 --- a/js/listWorker.js +++ b/js/listWorker.js @@ -244,18 +244,17 @@ class Model { if (NOCTURNAL.has(item)) includedIDs.push(i); } } else { - // BirdNET nocturnal bird filter - const additionalIDs = []; // Get list of IDs of birds that call through the night or all the time. Exclude non-avian classes for (let i = 0; i < this.labels.length; i++) { const item = this.labels[i]; if (ACTIVITY_INDEX[item] !== 1 && BIRDNET_NOT_BIRDS.indexOf(item) < 0) includedIDs.push(i); } - if (localBirdsOnly){ // placeholder for condition + if (localBirdsOnly){ + const additionalIDs = includedIDs; // Now get list of local birds const local_ids = await this.setList({lat,lon,week, listType:'location', useWeek, threshold}) // Create a list of indices that appear in both lists - includedIDs = includedIDs.filter(id => local_ids.included.includes(id)); + includedIDs = additionalIDs.filter(id => local_ids[0].included.includes(id)); } } } else if (listType === 'custom'){ diff --git a/js/ui.js b/js/ui.js index ee16531f..0522f9f6 100644 --- a/js/ui.js +++ b/js/ui.js @@ -31,10 +31,10 @@ const p = window.module.p; const SunCalc = window.module.SunCalc; const uuidv4 = window.module.uuidv4; const os = window.module.os; -/// Set up communication channel between UI and worker window let worker; +/// Set up communication channel between UI and worker window const establishMessageChannel = new Promise((resolve) => { window.onmessage = (event) => {