Sha256: 2326fcef15c6b5c41a269d3352e2b1df1fceed1b2c91a7332bf5830094c5c966

Contents?: true

Size: 863 Bytes

Versions: 10

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/patients"

module Renalware
  module Patients
    class ClearPatientUKRDCData
      pattr_initialize [:patient!, :by!]

      def self.call(**args)
        new(**args).call
      end

      # Note that we want to avoid any patient validation errors (email is invalid etc)
      # at this important stage, so we use validate: false. While we validate patient data
      # entered thorugh the UI, its possible that some migrated data might be invalid
      # and would cause an error to be raised during a callback in save!
      def call
        patient.send_to_rpv = false
        patient.rpv_decision_on = Time.zone.today
        patient.rpv_recorded_by = by.to_s
        patient.skip_death_validations = true
        patient.by = by
        patient.save!(validate: false)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.1.0 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.167 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.166 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.165 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.164 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.163 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.162 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.161 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.160 app/models/renalware/patients/clear_patient_ukrdc_data.rb