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.1.1 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.1.0 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.167 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.166 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.165 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.164 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.163 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.162 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.161 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.160 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.159 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.158 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.157 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.156 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.155 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.153 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.152 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.151 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.149 app/models/renalware/transplants/live_donors_query.rb
renalware-core-2.0.148 app/models/renalware/transplants/live_donors_query.rb