fix(api,web): show honest Confirmed count and ignore superseded auto-assigned occurrences #909
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/people-instance-counts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Person detail page for e.g. Rikke: people-list card says "818 photos · 42 auto-assigned", but the detail tabs showed "Confirmed 42 · Tentative 0".
Root cause (spec 048 follow-up): the Confirmed tab badge rendered
autoAssignedCount(occurrences in statetentative) — a spec 045 leftover that spec 048 superseded ("auto-assigned is never Confirmed"). The real accepted count was never displayed. "Tentative 0" is correct for its unit (pending spec-041 candidate cards). Secondary:auto_assigned_countlacked the non-supersededdiscovery_resultsjoin that media/face counts use, so superseded-backed tentative occurrences inflated it.Fix
ClassInstanceService.faceEnrichmentForPeople) now computesacceptedCount(SUM(state='accepted')) with the same non-supersededdiscovery_resultsjoin, and applies that join toauto_assigned_countas well; generic listing (ClassInstanceDiscoveryService.instances) and single-instance views carryacceptedCountand exclude superseded-backed tentative rows via a portable anti-join (generic occurrence keys are not always UUIDs).tentative_count(candidate cards) untouched. No migration.acceptedCountis present (defensive for legacy responses).Tests
ClassInstanceServiceTest(41) andClassInstanceDiscoveryServiceTest(209), controller mapping inDiscoveryControllerTest(63) — all green.npm run check0 errors, build ok;discovery-instance-tentative.spec.tsextended for mixed (5/42) and pure-shadow badges — 36 passed; alltests/discovery-*238 passed / 4 skipped.