@@ -6,6 +6,7 @@ module TriageMailerConcern
66 def send_triage_confirmation ( patient_session , consent )
77 session = patient_session . session
88 patient = patient_session . patient
9+ organisation = patient_session . organisation
910
1011 return unless patient . send_notifications?
1112 return if consent . via_self_consent?
@@ -17,7 +18,9 @@ def send_triage_confirmation(patient_session, consent)
1718 elsif vaccination_wont_happen? ( patient , consent )
1819 EmailDeliveryJob . perform_later ( :triage_vaccination_wont_happen , **params )
1920 elsif vaccination_at_clinic? ( patient , consent )
20- EmailDeliveryJob . perform_later ( :triage_vaccination_at_clinic , **params )
21+ email_template =
22+ resolve_email_template ( :triage_vaccination_at_clinic , organisation )
23+ EmailDeliveryJob . perform_later ( email_template , **params )
2124 elsif consent . requires_triage?
2225 EmailDeliveryJob . perform_later ( :consent_confirmation_triage , **params )
2326 elsif consent . response_refused?
@@ -54,4 +57,12 @@ def vaccination_at_clinic?(patient, consent)
5457 consent . requires_triage? &&
5558 patient . triage_status ( programme_id :) . delay_vaccination?
5659 end
60+
61+ def resolve_email_template ( template_name , organisation )
62+ template_names = [
63+ :"#{ template_name } _#{ organisation . ods_code . downcase } " ,
64+ template_name
65+ ]
66+ template_names . find { GOVUK_NOTIFY_EMAIL_TEMPLATES . key? ( it ) }
67+ end
5768end
0 commit comments