Skip to content

Track event-reg transfers via a back-link (fix lost attendance on transfer-in) - #2044

Open
maebeale wants to merge 5 commits into
mainfrom
maebeale/issue-1944
Open

Track event-reg transfers via a back-link (fix lost attendance on transfer-in)#2044
maebeale wants to merge 5 commits into
mainfrom
maebeale/issue-1944

Conversation

@maebeale

@maebeale maebeale commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 5 Inspect 🔬 self-FK + data migration, status-list change, new controller flow, and transferred-in surfaced across roster/dashboard/filters/exports

Closes #1944

What is the goal of this PR and why is this important?

  • Marking a registration transferred_in overwrote its attendance status, losing whether the person actually attended the event they transferred into.
  • Fix per the issue discussion: track the transfer as a relationship, not a status. A transferred_from_registration_id self-FK lives on the incoming record (an "in" is identifiable directly); the out stays identifiable by its terminal transferred_out status. Chained transfers form a linked list back to the original.

How did you approach the change?

  • Migration adds the indexed self-FK (on_delete: :nullify) and resets existing transferred_in rows to registered.
  • EventRegistration: drop transferred_in from the statuses; add transferred_from_registration / transferred_to_registration associations, transferred_in?, transfer_destination_pending?, and a transferred_in scope.
  • Follow-up UI: after marking Transferred out (no destination yet), the admin lands on a transfer screen to pick the destination event, scoped to the same kind of event (facilitator training ↔ facilitator training). It creates or links the person's registration there.

Designating "transferred in" (FK-backed, since it's no longer a status)

  • Roster badge gains an "In" marker beside the real status.
  • Edit form shows the in/out link from either end.
  • Dashboard attendance breakdown regains a transferred-in row, counted via the transfer link with a working drill-down.
  • Attendance-status filter (roster + reminder recipients) offers a "Transferred in" option — the value routes through the attendance_status scope to the FK, so no controller change.
  • CSV exports annotate the Status column with "(transferred in)".

Anything else to add?

  • The inline roster status chip still just flips the status; the transfer screen is reached from the full edit-form save (and the "Record where they transferred to" link).
  • Same-kind scoping is enforced at the picker; the POST endpoint doesn't reject an off-kind destination_event_id (out of scope for now).

Copilot AI review requested due to automatic review settings August 2, 2026 13:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 2, 2026 13:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale
maebeale marked this pull request as ready for review August 2, 2026 13:34
Copilot AI review requested due to automatic review settings August 2, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale
maebeale force-pushed the maebeale/issue-1944 branch from abd066d to 3613ba0 Compare August 2, 2026 22:31
Copilot AI review requested due to automatic review settings August 2, 2026 22:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

maebeale and others added 4 commits August 2, 2026 22:53
Add transferred_from_registration_id (self-FK) so an incoming registration
points back at the one it transferred out of. The in-record keeps its own real
attendance status, fixing the loss of attendance data when it was marked
"transferred_in"; an out stays identifiable by its terminal status. Adds a
follow-up screen to record/link the destination after marking transferred out.

Closes #1944

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover the transferred_from/to associations, transferred_in?/transfer_destination_pending?,
the post-save redirect to the transfer screen, and the transfer create/link flow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A facilitator training only transfers to another facilitator training, and a
non-training only to another non-training, so the destination picker matches
the source event's facilitator_training flag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Integrates with main's dashboard status breakdown (#2041): transferred_in is no
longer an attendance status, so its row raised KeyError on
ATTENDANCE_STATUS_LABELS.fetch and drilled into an empty roster filter. Remove
the row and update the status-based specs accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maebeale
maebeale force-pushed the maebeale/issue-1944 branch from 3613ba0 to b34dcfa Compare August 3, 2026 02:58
Copilot AI review requested due to automatic review settings August 3, 2026 02:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Transferred-in is now an FK-backed dimension (an incoming reg keeps its own
attendance status), so designate it wherever status is shown:
- roster badge gains an "In" marker alongside the real status
- dashboard attendance breakdown regains a transferred-in row, counted via the
  transfer link with a working drill-down
- the attendance-status filter (roster + reminder recipients) offers a
  "Transferred in" option, routed through the attendance_status scope to the FK
- CSV exports annotate the Status column with "(transferred in)"

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 3, 2026 03:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Event Reg - transferred in / transferred out

2 participants