Skip to content

Commit

Permalink
Fixed nocturnal filter when using location settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Feb 25, 2024
1 parent c85fcc5 commit 4e1ed0a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions Help/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@
Larger values lead to faster processing, especially on long files.
</td>
</tr>
<tr>
<th>Enable analysis completion notifications</th>
<td>
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.
</td>
</tr>
<tr>
<td colspan="2" class="text-center text-bg-light"><h5>Location</h5></td>
</tr>
Expand Down
7 changes: 3 additions & 4 deletions js/listWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'){
Expand Down
2 changes: 1 addition & 1 deletion js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 4e1ed0a

Please sign in to comment.