Sha256: cb04e39c82132a104ae8079a04ca38506cee7a6358e59d30dfb1c348f741e64d

Contents?: true

Size: 503 Bytes

Versions: 10

Compression:

Stored size: 503 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/pathology"
require "sql/indexed_case_stmt"

module Renalware
  module Pathology
    class OrderedPatientQuery
      def initialize(patient_ids)
        @patient_ids = patient_ids
      end

      def call
        Pathology::Patient
          .where(id: @patient_ids)
          .order(ids_index)
      end

      private

      def ids_index
        ::Sql::IndexedCaseStmt.new("patients.id", @patient_ids).generate
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.1.0 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.167 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.166 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.165 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.164 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.163 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.162 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.161 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.160 app/models/renalware/pathology/ordered_patient_query.rb