Class: Report::CallStatistics::CallStatResult

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::API, ActiveModel::Attributes, ActiveModel::Validations::Callbacks, StripAttributes
Defined in:
app/services/report/call_statistics/call_stat_result.rb

Overview

Service object: call stat result.

Direct Known Subclasses

CallStatResultSummary

Instance Method Summary collapse

Instance Method Details

#ext_conn_talk_time_humanizedObject



38
39
40
# File 'app/services/report/call_statistics/call_stat_result.rb', line 38

def ext_conn_talk_time_humanized
  format_time_for_humans ext_conn_talk_time_in_seconds
end

#format_time_for_humans(time_in_seconds) ⇒ Object (protected)



56
57
58
59
60
61
# File 'app/services/report/call_statistics/call_stat_result.rb', line 56

def format_time_for_humans(time_in_seconds)
  return unless time_in_seconds && time_in_seconds > 0

  # Time.at(time_in_seconds).utc.strftime("%H:%M:%S")
  Heatwave::Duration.humanize(time_in_seconds, format: :short, limit_to_hours: true, units: 2)
end

#inbound_direct_talk_time_humanizedObject



50
51
52
# File 'app/services/report/call_statistics/call_stat_result.rb', line 50

def inbound_direct_talk_time_humanized
  format_time_for_humans inbound_direct_talk_time_in_seconds
end

#inbound_from_queue_talk_time_humanizedObject



46
47
48
# File 'app/services/report/call_statistics/call_stat_result.rb', line 46

def inbound_from_queue_talk_time_humanized
  format_time_for_humans inbound_from_queue_talk_time_in_seconds
end

#outbound_talk_time_humanizedObject



34
35
36
# File 'app/services/report/call_statistics/call_stat_result.rb', line 34

def outbound_talk_time_humanized
  format_time_for_humans outbound_talk_time_in_seconds
end

#ttl_outbound_talk_time_humanizedObject



42
43
44
# File 'app/services/report/call_statistics/call_stat_result.rb', line 42

def ttl_outbound_talk_time_humanized
  format_time_for_humans(outbound_talk_time_in_seconds - ext_conn_talk_time_in_seconds)
end