Class: Assistant::TechnicalSupport::CaseLinkedCallRecordQuery

Inherits:
Object
  • Object
show all
Defined in:
app/queries/assistant/technical_support/case_linked_call_record_query.rb

Overview

Returns the explicit Support Case-to-CallRecord links used by both replay
readiness counts and case-level embedding aggregation.

Instance Method Summary collapse

Constructor Details

#initialize(scope: Activity.all) ⇒ CaseLinkedCallRecordQuery

Returns a new instance of CaseLinkedCallRecordQuery.



8
9
10
# File 'app/queries/assistant/technical_support/case_linked_call_record_query.rb', line 8

def initialize(scope: Activity.all)
  @scope = scope
end

Instance Method Details

#call(ids:) ⇒ Array<Array<Integer>>

Returns unique support-case/call-record ID pairs.

Parameters:

  • ids (ActiveRecord::Relation, Array<Integer>)

    Support Case IDs

Returns:

  • (Array<Array<Integer>>)

    unique support-case/call-record ID pairs



14
15
16
17
18
19
20
21
# File 'app/queries/assistant/technical_support/case_linked_call_record_query.rb', line 14

def call(ids:)
  scope
    .joins(:call_record)
    .merge(CallRecord.with_transcript)
    .where(resource_type: 'SupportCase', resource_id: ids)
    .distinct
    .pluck(:resource_id, :call_record_id)
end