Sha256: 7bf2ce8734ce83b11657a9589ac13847b4784f7f71b5bd0fa4373fc767d94c14

Contents?: true

Size: 493 Bytes

Versions: 56

Compression:

Stored size: 493 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(:id, @patient_ids).generate
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
renalware-core-2.0.111 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.110 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.109 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.108 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.106 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.105 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.104 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.103 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.102 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.101 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.100 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.99 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.98 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.97 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.96 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.95 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.94 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.93 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.92 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.91 app/models/renalware/pathology/ordered_patient_query.rb