Sha256: 1f384dd47d70a498be1c20feb97bdb73dfa24e59ae1355726521c43d049d8faa

Contents?: true

Size: 503 Bytes

Versions: 44

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

44 entries across 44 versions & 1 rubygems

Version Path
renalware-core-2.0.159 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.158 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.157 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.156 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.155 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.153 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.152 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.151 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.149 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.148 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.147 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.146 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.145 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.144 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.143 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.142 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.141 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.140 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.139 app/models/renalware/pathology/ordered_patient_query.rb
renalware-core-2.0.138 app/models/renalware/pathology/ordered_patient_query.rb