Fix false "Plex fallback" banner during the first scan
history_coverage is only written at the end of an ingest, but has_completion_data was reading from it. During the first scan the coverage table is empty while watch_event already holds tens of thousands of Tautulli rows, so the dashboard announced a fallback that had not happened and claimed the rejection component was disabled when it was not. The flag now comes from the events themselves — does any row carry a percent_complete — which is true the moment Tautulli rows land and false for Plex-only history. history_source falls back to the scan record when coverage is absent, so it reads "tautulli" mid-scan instead of null. Also: the banner named Plex as the source without checking, and now reports whichever source is actually active, and stays quiet while a scan is running since the counts are still moving. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GVbG48GAXfCZatcmX123Ra
This commit is contained in:
parent
a842aeb344
commit
71cfa31f09
4 changed files with 55 additions and 10 deletions
|
|
@ -19,6 +19,7 @@ const state = {
|
|||
views: [],
|
||||
lastPage: null,
|
||||
hasCompletion: true,
|
||||
scanning: false,
|
||||
};
|
||||
|
||||
/* ── helpers ──────────────────────────────────────────────────────── */
|
||||
|
|
@ -162,9 +163,11 @@ async function loadDashboard() {
|
|||
? 'Completion data available — the rejection component is active'
|
||||
: 'No completion data — running degraded, rejection component disabled';
|
||||
}
|
||||
if (!ov.has_completion_data && ov.watch_events > 0) {
|
||||
banner('warn', 'Watch history has no completion data (Plex fallback). ' +
|
||||
'The score is running degraded: the “rejection” component is disabled.');
|
||||
// Only a finished scan can tell us this; mid-scan the counts are still moving.
|
||||
if (!ov.has_completion_data && ov.watch_events > 0 && !state.scanning) {
|
||||
banner('warn', `Watch history has no completion data (source: ` +
|
||||
`${ov.history_source || 'unknown'}). The score is running degraded: ` +
|
||||
`the “rejection” component is disabled.`);
|
||||
}
|
||||
|
||||
// size by library
|
||||
|
|
@ -727,6 +730,7 @@ $('#scan-now').addEventListener('click', async () => {
|
|||
async function pollScan() {
|
||||
const btn = $('#scan-now');
|
||||
btn.disabled = true;
|
||||
state.scanning = true;
|
||||
const tick = async () => {
|
||||
const s = await api('/scans/current');
|
||||
if (s) {
|
||||
|
|
@ -735,6 +739,7 @@ async function pollScan() {
|
|||
} else {
|
||||
btn.textContent = 'Scan now';
|
||||
btn.disabled = false;
|
||||
state.scanning = false;
|
||||
$('#banner-area').replaceChildren();
|
||||
show(state.view);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue