Sha256: 05e0129223793c913eb57e80756e1fb64190b2d8707bbd34c42cfd6b6436bb51

Contents?: true

Size: 766 Bytes

Versions: 15

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module Patients
    class MDMPatientsQuery
      include ModalityScopes
      include PatientPathologyScopes
      attr_reader :modality_names, :q, :relation

      # modality_names: eg "HD" or "PD"
      def initialize(q:, modality_names:, relation: Patient.all)
        @modality_names = modality_names
        @q = q
        @relation = relation
      end

      def call
        search.result
      end

      def search
        @search ||= begin
          relation
            .extending(ModalityScopes)
            .extending(PatientPathologyScopes)
            .with_current_pathology
            .with_current_modality_matching(modality_names)
            .ransack(q)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.1.0 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.167 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.166 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.165 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.164 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.163 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.162 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.161 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.160 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.159 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.158 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.157 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.156 app/models/renalware/patients/mdm_patients_query.rb
renalware-core-2.0.155 app/models/renalware/patients/mdm_patients_query.rb