Sha256: c7be25a0c64aaa83834775c637a4a66886abb13c50f6236ad78ba688373114f1

Contents?: true

Size: 788 Bytes

Versions: 35

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/hd"

module Renalware
  module HD
    class PreferenceSet < ApplicationRecord
      include PatientScope
      include Accountable

      belongs_to :patient, touch: true
      belongs_to :hospital_unit, class_name: "Hospitals::Unit"
      belongs_to :schedule_definition, foreign_key: "schedule_definition_id"

      has_paper_trail class_name: "Renalware::HD::Version"

      validates :patient, presence: true
      validates :entered_on, timeliness: { type: :date, allow_blank: true }

      delegate :hospital_centre, to: :hospital_unit, allow_nil: true

      def preferred_schedule
        other_schedule || schedule_definition&.to_s
      end

      def self.policy_class
        BasePolicy
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
renalware-core-2.0.46 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.45 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.44 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.43 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.42 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.41 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.40 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.39 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.38 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.37 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.36 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.35 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.34 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.33 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.32 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.31 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.30 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.28 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.27 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.26 app/models/renalware/hd/preference_set.rb