Sha256: 625fdf5be10d6498e79334402ec0313545d99078a3d7f55f1f6a9d1218903a9b

Contents?: true

Size: 630 Bytes

Versions: 27

Compression:

Stored size: 630 Bytes

Contents

require_dependency "renalware/patients"

module Renalware
  module Patients
    class WorryQuery
      attr_reader :query_params

      def initialize(query_params)
        @query_params = query_params
        @query_params[:s] = "date_time DESC" if @query_params[:s].blank?
      end

      def call
        search
          .result
          .includes(:created_by, patient: { current_modality: [:description] })
          .order(created_at: :asc)
          .page(query_params[:page])
          .per(query_params[:per_page])
      end

      def search
        @search ||= Worry.ransack(query_params)
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.7 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.5 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.4 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.3 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.2 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.1 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.rc1 app/models/renalware/patients/worry_query.rb
renalware-core-2.0.0.pre.beta12 app/models/renalware/patients/worry_query.rb