Skip to content

Commit d07a9e5

Browse files
committed
Glance tile: library-enriched share, not watched-titles share
The landing tile divided enriched titles by distinct WATCHED titles and read 93% while the library cards - which divide by downloaded items - said 46/92/70/24. Both were true; the tile was mislabelled. It now takes the Knowledge-Base overview's basis (51% on the reference library) and keeps the watched-titles figure as the sub-label.
1 parent 5c554ad commit d07a9e5

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

frontend/index.html

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,22 +3519,42 @@ <h3 style="margin:0 0 4px;font-size:15px">Spotify Backlog</h3>
35193519
if (!el) return;
35203520
const isAdmin = !!currentUser?.is_admin;
35213521

3522-
const [enrich, recs, dels, tasks] = await Promise.allSettled([
3522+
const [enrich, overview, recs, dels, tasks] = await Promise.allSettled([
35233523
api('/api/enrichment/status?quick=true'),
3524+
api('/api/enrichment/overview'),
35243525
api('/api/recommendations/?source=cache&limit=1'),
35253526
isAdmin ? api('/api/recommendations/deletions?refresh=false') : Promise.resolve(null),
35263527
api('/api/tasks/history'),
35273528
]);
35283529

35293530
const tiles = [];
35303531

3532+
// Two honest numbers with two denominators. The Knowledge-Base overview
3533+
// divides by DOWNLOADED library items — the same basis as the per-library
3534+
// cards. The quick status divides by distinct WATCHED titles; that used to
3535+
// be this tile's only figure and read "93%" next to cards saying 46/92/70/24.
3536+
let libPct = null, watchedPct = null;
3537+
if (overview.status === 'fulfilled') {
3538+
let live = 0, of = 0;
3539+
for (const c of Object.values(overview.value.categories || {})) {
3540+
live += c?.states?.enriched_live || 0;
3541+
of += c?.denominator?.downloaded || 0;
3542+
}
3543+
if (of) libPct = Math.round(100 * live / of);
3544+
}
35313545
if (enrich.status === 'fulfilled') {
35323546
let done = 0, total = 0;
35333547
for (const c of Object.values(enrich.value.categories || {})) {
35343548
done += c?.enriched || 0;
35353549
total += c?.total_unique || 0;
35363550
}
3537-
if (total) tiles.push({num: Math.round(100 * done / total) + '%', lbl: 'Enriched', view: 'enrich'});
3551+
if (total) watchedPct = Math.round(100 * done / total);
3552+
}
3553+
if (libPct !== null) {
3554+
tiles.push({num: libPct + '%', view: 'enrich',
3555+
lbl: watchedPct !== null ? `Library enriched · ${watchedPct}% of watched titles` : 'Library enriched'});
3556+
} else if (watchedPct !== null) {
3557+
tiles.push({num: watchedPct + '%', lbl: 'Watched titles enriched', view: 'enrich'});
35383558
}
35393559

35403560
if (recs.status === 'fulfilled' && recs.value.recommendations) {

0 commit comments

Comments
 (0)