Skip to content

Commit 3ddc8fb

Browse files
committed
When creating sessions add suitable patients
This means that only patients who go to the school will be added to school sessions, and only patients with an unknown school will be added to the community clinic. Jira-Issue: MAV-1430
1 parent 3fcee86 commit 3ddc8fb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/lib/location_sessions_factory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def grouped_programmes
5353
def patient_ids
5454
@patient_ids ||=
5555
if location.generic_clinic?
56-
team.patients.pluck(:id)
56+
team.patients.where(school: nil).pluck(:id)
5757
else
5858
team.patients.where(school: location).pluck(:id)
5959
end

spec/lib/location_sessions_factory_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
session =
121121
team.sessions.includes(:patients).find_by(location:, academic_year:)
122122
expect(session.patients).to include(patient_at_location)
123-
expect(session.patients).to include(patient_at_school_location)
123+
expect(session.patients).not_to include(patient_at_school_location)
124124
end
125125
end
126126
end

0 commit comments

Comments
 (0)