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

Ext conn talk time humanized.

Returns:

  • (Object)


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

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)

Format time for humans.

Parameters:

  • time_in_seconds (Time)

Returns:

  • (Object)


69
70
71
72
73
74
# File 'app/services/report/call_statistics/call_stat_result.rb', line 69

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

Inbound direct talk time humanized.

Returns:

  • (Object)


60
61
62
# File 'app/services/report/call_statistics/call_stat_result.rb', line 60

def inbound_direct_talk_time_humanized
  format_time_for_humans inbound_direct_talk_time_in_seconds
end

#inbound_from_queue_talk_time_humanizedObject

Inbound from queue talk time humanized.

Returns:

  • (Object)


54
55
56
# File 'app/services/report/call_statistics/call_stat_result.rb', line 54

def inbound_from_queue_talk_time_humanized
  format_time_for_humans inbound_from_queue_talk_time_in_seconds
end

#outbound_talk_time_humanizedObject

Outbound talk time humanized.

Returns:

  • (Object)


36
37
38
# File 'app/services/report/call_statistics/call_stat_result.rb', line 36

def outbound_talk_time_humanized
  format_time_for_humans outbound_talk_time_in_seconds
end

#ttl_outbound_talk_time_humanizedObject

Ttl outbound talk time humanized.

Returns:

  • (Object)


48
49
50
# File 'app/services/report/call_statistics/call_stat_result.rb', line 48

def ttl_outbound_talk_time_humanized
  format_time_for_humans(outbound_talk_time_in_seconds - ext_conn_talk_time_in_seconds)
end