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:
Jess Hallsworth 2026-09-10 14:30:09 +00:00
parent a842aeb344
commit 71cfa31f09
No known key found for this signature in database
4 changed files with 55 additions and 10 deletions

View file

@ -212,7 +212,7 @@ def sources():
return jsonify({
"plex": {"configured": c.plex_configured, "base_url": c.plex_base_url},
"tautulli": {"configured": c.tautulli_configured, "base_url": c.tautulli_base_url},
"history_source": (cov[0]["source"] if cov else None),
"history_source": queries.active_history_source(d),
"has_completion_data": queries.history_has_completion(d),
"coverage": cov,
"providers": [dict(r) for r in d.query("SELECT * FROM provider")],