Sha256: 9059a0af5b7223adbb0a3e3e1c26cfbfaa8f7c2bb3de781ed28e6518d45f6668

Contents?: true

Size: 491 Bytes

Versions: 39

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/pathology"
require "sql/index_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(:id, @patient_ids).generate
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
renalware-core-2.0.51 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.50 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.48 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.47 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.46 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.45 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.44 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.43 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.42 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.41 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.40 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.39 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.38 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.37 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.36 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.35 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.34 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.33 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.32 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.31 app/models/renalware/pathology/ordered_patient_query.rb