Skip to content

O3-5459: Void/purge queue entries when associated visit is voided or purged#96

Open
dkayiwa wants to merge 3 commits intomainfrom
O3-5459/void-purge-queue-entries-on-visit-delete
Open

O3-5459: Void/purge queue entries when associated visit is voided or purged#96
dkayiwa wants to merge 3 commits intomainfrom
O3-5459/void-purge-queue-entries-on-visit-delete

Conversation

@dkayiwa
Copy link
Member

@dkayiwa dkayiwa commented Mar 3, 2026

Summary

When a visit is deleted (voided or purged), associated queue entries were not being removed, leaving patients visible in the service queue despite their visit being gone.

JIRA: O3-5459

Root Cause

The existing VisitWithQueueEntriesSaveHandler implements VoidHandler<Visit>, but this handler does not reliably fire when visitService.voidVisit() is called. The handler only works through the saveVisit() path. Additionally, there was no handling for purgeVisit() at all.

Changes

  • Added VisitWithQueueEntriesDeleteAdvice — an AOP MethodBeforeAdvice registered on VisitService that intercepts:
    • voidVisit(): voids all associated queue entries with the same void reason
    • purgeVisit(): purges all associated queue entries before the visit is permanently deleted (preventing FK constraint violations)
  • Registered the advice in config.xml via the <advice> element
  • Added tests for both void and purge scenarios

Testing

All 98 integration tests pass.

dkayiwa and others added 3 commits March 3, 2026 15:18
…purged

Add VisitWithQueueEntriesDeleteAdvice AOP advisor that intercepts
VisitService.voidVisit() and VisitService.purgeVisit() to ensure
associated queue entries are voided or purged accordingly. The existing
VoidHandler in VisitWithQueueEntriesSaveHandler does not reliably fire
when visitService.voidVisit() is called, so the AOP advice provides a
reliable mechanism for both void and purge paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Purge test now actually calls visitService.purgeVisit() to verify
  the FK constraint issue is resolved end-to-end
- Void test now isolates the advice behavior, proving the advice
  (not the VoidHandler) is what voids the queue entries

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant