Sha256: 89265073c9dd4e8cb748bca35b6718567872ae763d7fcc225f8d0d2f608b8c8b

Contents?: true

Size: 822 Bytes

Versions: 15

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

      has_paper_trail(
        versions: { 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

15 entries across 15 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/hd/preference_set.rb
renalware-core-2.1.0 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.167 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.166 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.165 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.164 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.163 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.162 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.161 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.160 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.159 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.158 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.157 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.156 app/models/renalware/hd/preference_set.rb
renalware-core-2.0.155 app/models/renalware/hd/preference_set.rb