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.0.147 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.146 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.145 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.144 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.143 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.142 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.141 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.140 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.139 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.138 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.137 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.136 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.135 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.134 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.133 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.132 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.131 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.130 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.129 app/presenters/renalware/admissions/consult_summary_part.rb
renalware-core-2.0.128 app/presenters/renalware/admissions/consult_summary_part.rb