Skip to content

Surface a "captures have no session, click to regroup" affordance to users #1267

@mihow

Description

@mihow

Summary

Users have no way to tell from the UI that captures in their deployment aren't grouped into sessions. The state manifests as occurrences without a session, stale taxa counts on the project, and no actionable hint — triage today requires Django shell access or the Django admin (only available to staff). We already have a clean pattern for this: the "capture set is empty — click Populate" card. Let's do the same for ungrouped captures.

Observed on a production deployment (2026-04-23): one camera had ~165k (~25%) of its source images with event = NULL, and a corresponding ~70% of that project's occurrences showed "no session" in the UI. From the user's perspective, nothing looked broken — the data was just quietly wrong.

The ask

  • Expose an orphan count on Deployment (e.g. source_images_without_event_count) updated by Deployment.update_calculated_fields, same pattern as the existing capture-set size counters.
  • When > 0, surface a suggested action card on the deployment page (and bubble up to the project page), matching the "This capture set is empty — click Populate" pattern. Wording: "N captures aren't grouped into a session. Click Regroup to fix."
  • The action fires regrouping as a Job (not a bare celery task), so progress / cancel / retry / logs are visible in the jobs UI like every other user-triggered operation. This is what Expose session regrouping as a job stage when syncing images #1157 already proposes; this ticket is about adding the upstream UI that dispatches it.
  • On the occurrences list page, if the current filter includes null-session occurrences, show a non-blocking banner linking to the deployment(s) responsible.

Why a separate ticket

The surrounding "make regrouping reliable and visible" problem is already tracked and being worked on — I'm not duplicating that work:

What none of those tickets cover is the user-facing fix-me affordance: once the data is orphaned (either from a pre-#904 sync, a partial sync, or any future corner case), a non-staff user has no way to notice or self-serve a fix. That's the gap this ticket is asking to close.

Acceptance

  • Deployment page shows a dismissable/actionable card when orphan count > 0, identical in shape to the capture-set "empty — populate" card.
  • Clicking it creates a visible Job (per Expose session regrouping as a job stage when syncing images #1157's job-type work) that users can watch succeed or fail.
  • Orphan count goes to zero, card disappears on refresh.
  • Occurrence list banner appears when the current filter has null-session results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions