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.104 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.103 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.102 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.101 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.100 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.99 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.98 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.97 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.96 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.95 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.94 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.93 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.92 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.91 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.90 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.89 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.88 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.87 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.86 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.85 app/models/renalware/transplants/live_donors_query.rb