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.30 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.28 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.27 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.26 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.25 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.24 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.23 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.22 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.21 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.20 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.18 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.17 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.16 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.15 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.14 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.13 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.12 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.11 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.9 app/models/renalware/pathology/ordered_patient_query.rb