Sha256: db5928e244e9bbcfe3d45ad7ae6c98e3ee92c64d8bad4bc36fcf4db7dca02969

Contents?: true

Size: 538 Bytes

Versions: 8

Compression:

Stored size: 538 Bytes

Contents

module Renalware
  module Patients
    class PracticeSearchQuery
      attr_reader :search_term

      def initialize(search_term:)
        @search_term = search_term
      end

      def call
        return [] unless search_term.present?

        term = "%#{search_term}%"
        Practice.select(:id, :name)
                .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

8 entries across 8 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta11 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.beta10 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.beta9 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.beta8 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.beta7 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.beta6 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.beta5 app/models/renalware/patients/practice_search_query.rb
renalware-core-2.0.0.pre.beta4 app/models/renalware/patients/practice_search_query.rb