class GovukNotifyPersonalisation::MmrDetailsPresenter
Attributes
Public Class Methods
Source
# File app/lib/govuk_notify_personalisation/mmr_details_presenter.rb, line 5 def initialize(personalisation) @personalisation = personalisation end
Public Instance Methods
Source
# File app/lib/govuk_notify_personalisation/mmr_details_presenter.rb, line 18 def invitation_to_clinic_custom_mmr_message return "" unless mmr_second_dose_required? case team&.organisation&.ods_code when "RT5" # Leicestershire Partnership Trust (LPT) [ mmr_second_dose_waiting_period_message, "Itβs also possible for #{short_patient_name} to be vaccinated at your local GP surgery. " \ "To book an appointment, contact the surgery in the usual way." ].join("\n\n") when "RYG" # Coventry & Warwickshire Partnership NHS Trust (CWPT) [ mmr_second_dose_waiting_period_message, "## You have 2 options for booking the vaccination", "You can ask your local GP surgery to give #{short_patient_name} their 2nd dose. " \ "To book an appointment, contact the surgery in the usual way." ].join("\n\n") end end
Source
# File app/lib/govuk_notify_personalisation/mmr_details_presenter.rb, line 38 def invitation_to_clinic_generic_message [ ( if mmr_second_dose_required? "If you would like your local GP surgery to give #{short_patient_name} " \ "their 2nd dose, contact the surgery in the usual way." end ), "#{mmr_second_dose_required? ? "Alternatively, they" : "They"} can have this vaccination " \ "at a community clinic. If youβd like to book a clinic appointment, please contact " \ "us using the details below.", (mmr_second_dose_waiting_period_message if mmr_second_dose_required?) ].compact.join("\n\n") end
Source
# File app/lib/govuk_notify_personalisation/mmr_details_presenter.rb, line 53 def mmr_or_mmrv_vaccine return if mmr_programme.blank? if mmr_programme.variant_type == "mmrv" "MMR or MMRV vaccine" else "MMR vaccine" end end
Source
# File app/lib/govuk_notify_personalisation/mmr_details_presenter.rb, line 63 def mmr_programme @mmr_programme ||= programmes.find(&:mmr?) end
Source
# File app/lib/govuk_notify_personalisation/mmr_details_presenter.rb, line 67 def mmr_second_dose_required? mmr_programme.present? && patient_on_last_dose? end
Source
# File app/lib/govuk_notify_personalisation/mmr_details_presenter.rb, line 71 def next_mmr_dose_date return if patient.nil? return if mmr_programme.nil? patient .programme_status(mmr_programme, academic_year:) .next_dose_eligible_date &.to_fs(:long) end
Source
# File app/lib/govuk_notify_personalisation/mmr_details_presenter.rb, line 81 def patient_on_last_dose? return unless patient return if mmr_programme.nil? patient .reload .programme_status(mmr_programme, academic_year:) .on_last_dose? end