Sha256: e073bc687662d290febb129b803a61d54db46a75d2c4527a184dbedeec90042f

Contents?: true

Size: 1.28 KB

Versions: 19

Compression:

Stored size: 1.28 KB

Contents

require_dependency "renalware/pathology"

module Renalware
  module Pathology
    module Requests
      class RequestPresenter < SimpleDelegator
        def self.present(requests)
          requests.map { |request| new request }
        end

        def patient_name
          patient.full_name.upcase
        end

        def date
          I18n.l Date.current
        end

        def date_of_birth
          I18n.l patient.born_on
        end

        def consultant
          request_form.consultant.full_name
        end

        def clinical_detail
          clinic.name
        end
        alias_method :contact, :clinical_detail

        def requested_by
          return "" if created_by.nil?

          created_by.full_name
        end

        def patient_rules
          ::Renalware::Pathology::Requests::PatientRulePresenter.present(super)
        end

        def global_requests_by_lab_and_bottle_type
          request_descriptions.group_by do |request_description|
            [request_description.lab.name, request_description.bottle_type]
          end
        end

        def patient_requests_by_lab
          patient_rules.group_by { |patient_rule| patient_rule.lab.name }
        end

        private

        def request_form
          __getobj__
        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/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.rc10 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.rc9 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.rc8 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.rc7 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.rc6 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.rc5 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.rc4 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.rc3 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.rc1 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.beta12 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.beta11 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.beta10 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.beta9 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.beta8 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.beta7 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.beta6 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.beta5 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.0.pre.beta4 app/presenters/renalware/pathology/requests/request_presenter.rb