Skip to content

Conversation

thomasleese
Copy link
Contributor

This fixes a bug where patients who are eligible for multiple programmes were being sent clinic invitations where they shouldn't have been. The specific scenario is where a patient is vaccinated for one programme and consent refused for another, therefore the parents shouldn't receive an invitation to the clinic, but the code was incorrectly deciding that the patient should.

The code wasn't treating the programmes individually, so it was seeing one programme as unvaccinated and another programme as consent given and deciding therefore that the patient should be sent the invitation.

@thomasleese thomasleese added the bug Something isn't working label Apr 8, 2025
Copy link
Contributor

@jhenderson jhenderson left a comment

Choose a reason for hiding this comment

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

LGTM

@thomasleese thomasleese force-pushed the fix-incorrect-clinic-session-invites branch from bb2856a to 6937cae Compare April 8, 2025 16:40
@thomasleese
Copy link
Contributor Author

@jhenderson Your comment seems to have disappeared, but good catch, I've amended the commit to make sure the tests are actually working as expected.

@jhenderson
Copy link
Contributor

@jhenderson Your comment seems to have disappeared, but good catch, I've amended the commit to make sure the tests are actually working as expected.

I deleted it because it did fail when I ran the full spec, so I wasn't 100% sure, but yeah it would make sense for the specific test you wrote to fail if we changed the logic.

Also had this suggestion if you wanted to get rid of the !all_vaccinated_or_consent_refused:

eligible_programmes.any? do |programme|
  status = patient.vaccination_status(programme:)
  consent = patient.consent_status(programme:)

  !status.vaccinated? && !consent.refused?
end

@thomasleese thomasleese force-pushed the fix-incorrect-clinic-session-invites branch from 6937cae to 94dc4a1 Compare April 8, 2025 19:53
@thomasleese thomasleese added this to the v2.2.0 milestone Apr 9, 2025
@thomasleese thomasleese force-pushed the fix-incorrect-clinic-session-invites branch from 94dc4a1 to cd311fa Compare April 9, 2025 14:26
@thomasleese thomasleese force-pushed the fix-incorrect-clinic-session-invites branch from cd311fa to 83494e8 Compare April 9, 2025 17:58
@tvararu tvararu temporarily deployed to mavis-pr-3357 April 9, 2025 17:59 Inactive
@thomasleese thomasleese force-pushed the fix-incorrect-clinic-session-invites branch from 83494e8 to cceb100 Compare April 15, 2025 11:05
@thomasleese thomasleese changed the base branch from main to v2.2.0-wip April 15, 2025 11:05
@thomasleese thomasleese force-pushed the fix-incorrect-clinic-session-invites branch 2 times, most recently from 4f854f4 to 2ef7c24 Compare April 16, 2025 06:09
@thomasleese thomasleese force-pushed the fix-incorrect-clinic-session-invites branch from 2ef7c24 to 92a05c2 Compare April 17, 2025 11:17
Base automatically changed from v2.2.0-wip to main April 17, 2025 11:27
This fixes a bug where patients who are eligible for multiple programmes
were being sent clinic invitations where they shouldn't have been. The
specific scenario is where a patient is vaccinated for one programme and
consent refused for another, therefore the parents shouldn't receive an
invitation to the clinic, but the code was incorrectly deciding that the
patient should.

The code wasn't treating the programmes individually, so it was seeing
one programme as unvaccinated and another programme as consent given and
deciding therefore that the patient should be sent the invitation.
@thomasleese thomasleese force-pushed the fix-incorrect-clinic-session-invites branch from 92a05c2 to 74a14cf Compare April 17, 2025 12:07
@thomasleese thomasleese requested a review from misaka April 17, 2025 12:07
Copy link

@thomasleese thomasleese enabled auto-merge April 17, 2025 12:53
@thomasleese thomasleese merged commit 9d28435 into main Apr 17, 2025
16 checks passed
@thomasleese thomasleese deleted the fix-incorrect-clinic-session-invites branch April 17, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants