Sha256: f502b6e7203ca5f35e9c494ff926808d55c5d99c10b05effe25fa7c627355f52

Contents?: true

Size: 985 Bytes

Versions: 19

Compression:

Stored size: 985 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/renal"

module Renalware
  module Renal
    class AKIAlert < ApplicationRecord
      include Accountable
      include PatientsRansackHelper
      scope :ordered, -> { order(created_at: :desc) }
      belongs_to :patient, class_name: "Renal::Patient", touch: true
      belongs_to :action, class_name: "Renal::AKIAlertAction"
      belongs_to :hospital_ward, class_name: "Hospitals::Ward"
      validates :patient, presence: true
      validates :max_aki, inclusion: 1..3, allow_nil: true
      alias_attribute :decided_by, :updated_by

      scope :today, -> { where(created_at: Time.zone.today.all_day) }
      scope :hotlist, -> { where(hotlist: true) }

      has_paper_trail(
        versions: { class_name: "Renalware::Renal::Version" },
        on: [:create, :update, :destroy]
      )

      ransacker :created_at_casted do |_parent|
        Arel.sql("date(renal_aki_alerts.created_at)")
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/renal/aki_alert.rb
renalware-core-2.1.0 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.167 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.166 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.165 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.164 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.163 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.162 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.161 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.160 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.159 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.158 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.157 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.156 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.155 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.153 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.152 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.151 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.149 app/models/renalware/renal/aki_alert.rb