Sha256: 794b8059750024c981b9457c2f86bda6a6139cf2e55425f0eb9fa0fc91f915b3

Contents?: true

Size: 557 Bytes

Versions: 16

Compression:

Stored size: 557 Bytes

Contents

# frozen_string_literal: true

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_definition = nil
        hd_profile.save_by!(by)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
renalware-core-2.0.64 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.63 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.62 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.61 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.60 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.58 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.57 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.56 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.55 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.54 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.53 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.52 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.51 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.50 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.48 app/models/renalware/hd/patient_listener.rb
renalware-core-2.0.47 app/models/renalware/hd/patient_listener.rb