Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) O3-3066 update queue entries accordingly after merging patients #69

Closed
wants to merge 2 commits into from

Conversation

chibongho
Copy link
Contributor

When merging 2 patients, all queue entries from the loser (voided) patient should be set to associate with the winner patient.

This PR does it by adding a SaveHandler on PersonMergeLog. Not sure if this is the right approach, since we have the same issue of needing to update queue entries when merging visits, we can't do something similar since there is no VisitMergeLog.

@chibongho chibongho requested review from mseaton and cioan April 11, 2024 16:03
@chibongho chibongho marked this pull request as draft April 11, 2024 16:03
Copy link
Member

@mseaton mseaton left a comment

Choose a reason for hiding this comment

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

One comment but generally looks good to me, assuming this works. Do the save handlers operate in the same transaction? Hard to test with our junit tests which work within a single transaction that gets rolled back, but I would think you could / should test what happens if there is an exception thrown by the SaveHandler - do things end up in an invalid state?

Person winner = mergeLog.getWinner();
Person loser = mergeLog.getLoser();
Patient winnerPatient = Context.getPatientService().getPatient(winner.getPersonId());
Patient loserPatient = Context.getPatientService().getPatient(loser.getPersonId());
Copy link
Member

Choose a reason for hiding this comment

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

You should Autowire the patient service in through the constructor as you are doing with the QueueEntryService

@chibongho
Copy link
Contributor Author

Closing this as this approach does not work, unfortunately. The SaveHandler does not seem to be called within the same transaction that initiates the merge.

@chibongho chibongho closed this Apr 18, 2024
@mseaton mseaton reopened this May 1, 2024
@mseaton mseaton closed this May 1, 2024
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.

2 participants