diff --git a/avian/frontend/apt.js b/avian/frontend/apt.js
index 55642ae..5e0a227 100644
--- a/avian/frontend/apt.js
+++ b/avian/frontend/apt.js
@@ -937,7 +937,7 @@
var sortMode = (window.__atlasSort) || 'count';
var species = filtered.slice();
if (sortMode === 'count') {
- species.sort(function (a, b) { return (+b.total) - (+a.total); });
+ species.sort(function (a, b) { return (+b.n) - (+a.n); });
} else if (sortMode === 'recent') {
species.sort(function (a, b) {
return (b.last_seen || '').localeCompare(a.last_seen || '');
@@ -948,14 +948,21 @@
});
}
+ // A species is a "lifer" in the current view if its all-time first
+ // detection falls inside the selected window - i.e. it was newly added
+ // to the life list this 1h / 12h / 24h / 7d. Never shown for the ALL
+ // window (every species would qualify against an open-ended span).
+ var now = Date.now();
+ var windowStartMs = now - currentHours * 3600000;
grid.innerHTML = species.map(function (s) {
- var total = +s.total || 0;
+ var total = +s.n || 0;
var win = winBySci[s.sci] || 0;
+ var firstMs = Date.parse((s.first_seen || '').replace(' ', 'T'));
+ var isLifer = !isAllWindow && !isNaN(firstMs) && firstMs >= windowStartMs;
var sketchSrc = './avian/api/cutout.php?sci=' + encodeURIComponent(s.sci) +
(s.com ? '&com=' + encodeURIComponent(s.com) : '') +
'&v=' + SKETCH_VERSION;
var audioSrc = './avian/api/recording.php?sci=' + encodeURIComponent(s.sci);
- var spectroSrc = './avian/api/spectrogram.php?sci=' + encodeURIComponent(s.sci);
// The "all time" window makes the windowed count identical to the
// all-time count - collapse to a single stat rather than print the
// same number twice. Otherwise label the count with its span.
@@ -964,14 +971,15 @@
: '