Sha256: b8d2629697ecd1c89699769c17aeb6bcbe3a2f1c0e8c97f7dd01fbcd103f14e0

Contents?: true

Size: 560 Bytes

Versions: 5

Compression:

Stored size: 560 Bytes

Contents

# rubocop:disable Rails/SkipsModelValidations
module Renalware
  module HD
    class PatientListener
      def patient_modality_changed_to_death(patient:, modality:, actor:)
        nullify_significant_hd_profile_attributes(patient, by: actor)
      end

      private

      def nullify_significant_hd_profile_attributes(patient, by:)
        hd_profile = HD.cast_patient(patient).hd_profile
        return if hd_profile.nil?
        hd_profile.hospital_unit = nil
        hd_profile.schedule = nil
        hd_profile.save_by!(by)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta9 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.0.pre.beta8 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.0.pre.beta7 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.0.pre.beta6 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.0.pre.beta5 app/models/renalware/hd/patient_listener.rb