Skip to content

Commit b6ca9e4

Browse files
committed
Support MMRV in patient session pages
This ensures that triage for MMRV is supported. The programme setter has to take into account the variants instead of just the types of programmes. This hasn't been a problem so far as triage for verbal consent is built into the consent flow rather than a separate action.
1 parent 26e7398 commit b6ca9e4

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

app/controllers/patient_sessions/base_controller.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,13 @@ def set_patient_location
4444
end
4545

4646
def set_programme
47-
return unless params.key?(:programme_type) || params.key?(:type)
47+
requested_type = params[:programme_type].presence || params[:type].presence
48+
return unless requested_type
4849

4950
programme =
5051
@session
5152
.programmes_for(patient: @patient)
52-
.find do |programme|
53-
programme.type == params[:programme_type] ||
54-
programme.type == params[:type]
55-
end
53+
.find { it.variants.any? { |v| v.to_param == requested_type } }
5654

5755
raise ActiveRecord::RecordNotFound if programme.nil?
5856

0 commit comments

Comments
 (0)