ROCK-8575: Revert Medication Manager to Person-only reads#230
Open
jwakefield-secc wants to merge 3 commits into
Open
ROCK-8575: Revert Medication Manager to Person-only reads#230jwakefield-secc wants to merge 3 commits into
jwakefield-secc wants to merge 3 commits into
Conversation
Adds a WorkflowTrigger on AttributeValue PostSave (scoped by qualifier to the MedicationActive attribute id) that fires a transient workflow whose only action is the new PropagateMedicationActiveState ActionComponent. The component reads the saved AV's parent matrix item, confirms it belongs to a Person master matrix, and writes the new active value to every snapshot matrix item the same person has that matches by composite key (Medication + Instructions + Schedule). Covers all surfaces that can change MedicationActive on the master (dispense modal, /myevents workflow 570, Person profile attribute matrix editor, REST, direct SQL) without modifying Rock core or workflow 570. Snapshot writes do not re-trigger because they fail the IsMasterMatrix check -- automatic loop prevention without a recursion guard. Kill switch: UPDATE WorkflowTrigger SET IsActive = 0 WHERE [Guid] = 'CC5A8B9C-1A2B-4C3D-9E5F-6A7B8C9D0E1F' Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
No behavior change. Drops redundant XML doc paragraphs and per-step "Args:" comments in the migration. Keeps the kill-switch instruction and non-obvious "why" notes (EntityType pinning, EntityTypeQualifier scoping, snapshot-write loop prevention, Schedule order-sensitivity). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Roll back the GroupMember snapshot direction in the Medication Dispense grid. Nothing populates GroupMember.Medications in prod, which was causing ~6,300 campers to render blank in the grid. Every other medication consumer (camp report stored proc, kiosk labels, MyEvents family info block, leader notifications) already reads Person.Medications. - Strip the qrySnapshot LINQ branch and groupMemberMatrixAttributeIds. Grid reads exclusively from Person.Medications. - Manage Medications modal opens against the Person master; Edit and Add write to the master, Toggle Active flips MedicationActive on the master. - Remove Delete entirely (column, handler, defense guards). Staff use the Active toggle to deactivate instead. - Drop dead source-aware plumbing: SourcePerson/SourceSnapshot constants, IsSnapshotMatrix method, hfManageMedsSource hidden field, badge literal, source parameter on the configure helper. UX add: inactive-but-distributed-today rows stay visible, grayed out with an "Inactive" badge and Dispense disabled, so same-day audit trail is preserved. Filter is per-(person, medicine, schedule) so distributing breakfast and then deactivating the med doesn't leak lunch and dinner rows into the grid. Perf: index today's distribution notes into a HashSet keyed by (PersonId | MatrixItemId | ScheduleGuid) for O(1) lookup during the inactive filter, avoiding a per-medicine linear scan on heavy-load days. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GroupMember.Medicationsin prod, which was causing ~6,300 active campers to render blank in the grid. The dispense grid now reads exclusively fromPerson.Medications, matching every other medication consumer (camp report stored proc, kiosk labels, MyEvents family info block, leader notifications).MedicationActiveon the master. Delete is removed entirely — staff use the Active toggle to deactivate instead.MedicationActivefiltering elsewhere (stored proc, kiosk labels, family info block, leader notifications) is unchanged and continues to work correctly against Person.What's removed (dead code cleanup)
qrySnapshotLINQ branch,groupMemberMatrixAttributeIds,groupMemberMatrixValuesWithItemsSourcePerson/SourceSnapshotconstantsIsSnapshotMatrixmethodbtnDeleteMed_ClickhandlerhfManageMedsSourcehidden field,ltManageMedsSourceBadgeliteral,<Rock:DeleteField>columnsourceparameter on the modal configure helper (renamed toConfigureManageMedsModal)Performance note
The inactive-but-distributed check uses a
HashSet<string>keyed by(PersonId | MatrixItemId | ScheduleGuid)built once before the per-camper loop. O(1) lookup; safe for heavy-load Camp Freedom days (~40 meds × 200 campers × ~1000 daily distributions).Behavioral implications worth flagging to camp ops
GroupMember.Medicationssnapshot infrastructure is now formally vestigial in prod. Cleanup of the auto-init Medications attribute on camp GroupTypes is an optional follow-up (separate ticket).Files changed
Net -14 lines across the two files.
Test plan
Person.Medications(no blank rows)Person.MedicationsMedicationActiveflips on the Person matrix item🤖 Generated with Claude Code