Sha256: 85650803c604768d1a3eecf4a23d0b09db47a9a46a76821565927986128710e1

Contents?: true

Size: 915 Bytes

Versions: 86

Compression:

Stored size: 915 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/medications"
require "collection_presenter"

module Renalware
  module Admissions
    class ConsultSummaryPart < Renalware::SummaryPart
      delegate :nhs_number, to: :patient, prefix: true

      def consults
        @consults ||= begin
          CollectionPresenter.new(
            Admissions::Consult
              .where(patient: patient)
              .includes(:created_by, :hospital_ward, :patient)
              .order(started_on: :desc)
              .limit(5),
            Renalware::Admissions::ConsultPresenter
          )
        end
      end

      def consults_count
        title_friendly_collection_count(
          actual: consults.size,
          total: Admissions::Consult.where(patient: patient).count
        )
      end

      def to_partial_path
        "renalware/admissions/consults/summary_part"
      end
    end
  end
end

Version data entries

86 entries across 86 versions & 1 rubygems

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