Sha256: d87ba07fea6a798ce024082b72472bc85bc4e7c21d5e940af55ca9a83e9ee7da

Contents?: true

Size: 856 Bytes

Versions: 19

Compression:

Stored size: 856 Bytes

Contents

require_dependency "renalware/clinical"

module Renalware
  module Clinical
    class DryWeightsPresenter
      DEFAULT_LIMIT = 10_000
      attr_reader :patient, :limit

      def initialize(patient:, dry_weights: nil, limit: nil)
        @patient = patient
        @limit = limit || DEFAULT_LIMIT
        @weights = dry_weights # optional otherwise we grab them ourselves
      end

      def weights
        @weights ||= begin
          Renalware::Clinical::DryWeight.for_patient(patient)
                                        .includes(:assessor)
                                        .limit(limit)
                                        .ordered
        end
      end

      def dry_weights
        @dry_weights ||= begin
          CollectionPresenter.new(weights, Renalware::Clinical::DryWeightPresenter)
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc11 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.rc10 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.rc9 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.rc8 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.rc7 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.rc6 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.rc5 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.rc4 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.rc3 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.rc1 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.beta12 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.beta11 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.beta10 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.beta9 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.beta8 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.beta7 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.beta6 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.beta5 app/presenters/renalware/clinical/dry_weights_presenter.rb
renalware-core-2.0.0.pre.beta4 app/presenters/renalware/clinical/dry_weights_presenter.rb