Skip to content

Commit 8d19c24

Browse files
committed
Hide archived patients from invite to clinic count
We won't send any invitations to these patients anyway, so we should hide them from the count. Jira-Issue: MAV-5055
1 parent 3e39de8 commit 8d19c24

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

app/controllers/schools/invite_to_clinic_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def set_patients_to_invite
7171
}
7272
)
7373
.where(school_id: @location.school_id)
74+
.not_archived(team: current_team)
7475
.includes_statuses
7576
.has_programme_status(
7677
@programme_statuses,

spec/features/schools_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ def given_a_team_with_no_known_school_children
172172
end
173173

174174
# We create these to ensure these children aren't invited.
175+
176+
# No parent contact details
175177
create(
176178
:patient,
177179
:consent_no_response,
@@ -181,6 +183,8 @@ def given_a_team_with_no_known_school_children
181183
location: @generic_clinic,
182184
academic_year: AcademicYear.pending
183185
)
186+
187+
# Refused consent
184188
create(
185189
:patient,
186190
:consent_refused,
@@ -190,6 +194,8 @@ def given_a_team_with_no_known_school_children
190194
location: @generic_clinic,
191195
academic_year: AcademicYear.pending
192196
)
197+
198+
# Conflicting consent
193199
create(
194200
:patient,
195201
:consent_conflicting,
@@ -200,6 +206,19 @@ def given_a_team_with_no_known_school_children
200206
academic_year: AcademicYear.pending
201207
)
202208

209+
# Archived
210+
create(
211+
:patient,
212+
:consent_no_response,
213+
:archived,
214+
school: nil,
215+
parents: [build(:parent)],
216+
programmes:,
217+
location: @generic_clinic,
218+
academic_year: AcademicYear.pending,
219+
team: @team
220+
)
221+
203222
@nurse = create(:nurse, team: @team)
204223
end
205224

0 commit comments

Comments
 (0)