Sha256: dc194fb76ea30d5d0d3f829a24b1508e342fe554d3bc556a7f18849f4fa2a0b1

Contents?: true

Size: 543 Bytes

Versions: 12

Compression:

Stored size: 543 Bytes

Contents

module Renalware
  module Patients
    class PracticeSearchQuery
      attr_reader :search_term

      def initialize(search_term:)
        @search_term = search_term
      end

      def call
        return [] if search_term.blank?

        term = "%#{search_term}%"
        Practice.select(:id, :name)
                .left_outer_joins(:address)
                .where("patient_practices.name ILIKE ? OR addresses.postcode ILIKE ?", term, term)
        # .select("patient_practices.id", "patient_practices.name")
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
renalware-core-2.0.5 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.4 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.3 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.2 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.1 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/patients/practice_search_query.rb