Sha256: b7961fdabbd878079c3d0db36dd67b2c260e21d2eb2d5820dec485c7b33234f4

Contents?: true

Size: 822 Bytes

Versions: 95

Compression:

Stored size: 822 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", on: [:create, :update, :destroy]

      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

95 entries across 95 versions & 1 rubygems

Version Path
renalware-core-2.0.148 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.147 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.146 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.145 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.144 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.143 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.142 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.141 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.140 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.139 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.138 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.137 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.136 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.135 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.134 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.133 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.132 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.131 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.130 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.129 app/models/renalware/hd/preference_set.rb