Sha256: 38b283713d48607977009caa3113ebeb3c7f13b43ef42c25ea934af75f3b8516

Contents?: true

Size: 671 Bytes

Versions: 98

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module Transplants
    class LiveDonorsQuery
      include ModalityScopes
      DEFAULT_ORDER = %w(family_name given_name).freeze

      def initialize(q = {})
        @q = q
      end

      def call
        search.result
      end

      def search
        @search ||= begin
          relation.ransack(q).tap do |search|
            search.sorts = DEFAULT_ORDER
          end
        end
      end

      private

      def relation
        Patient
          .all
          .extending(ModalityScopes)
          .with_current_modality_of_class(DonorModalityDescription)
      end

      attr_reader :q
    end
  end
end

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
renalware-core-2.0.127 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.126 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.125 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.124 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.123 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.121 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.120 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.119 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.118 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.117 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.116 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.115 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.113 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.112 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.111 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.110 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.109 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.108 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.106 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.105 app/models/renalware/transplants/live_donors_query.rb