feat: Agent & Inbox Report APIs (#1391)

This commit is contained in:
Sojan Jose
2020-11-16 19:41:52 +05:30
committed by GitHub
parent faaed17418
commit eb2ded6f65
11 changed files with 102 additions and 12 deletions

View File

@@ -0,0 +1,12 @@
<% headers = ['Agent name', 'Conversations count', 'Avg first response time (Minutes)', 'Avg resolution time (Minutes)'] %>
<%= CSV.generate_line headers %>
<% Current.account.users.each do |agent| %>
<% agent_report = V2::ReportBuilder.new(Current.account, {
type: :agent,
id: agent.id,
since: params[:since],
until: params[:until]
}).summary %>
<% row = [ agent.name, agent_report[:conversations_count], (agent_report[:avg_first_response_time]/60).to_i, (agent_report[:avg_resolution_time]/60).to_i ] %>
<%= CSV.generate_line row %>
<% end %>

View File

@@ -0,0 +1,12 @@
<% headers = ['Inbox name', 'Conversations count', 'Avg first response time (Minutes)', 'Avg resolution time (Minutes)'] %>
<%= CSV.generate_line headers %>
<% Current.account.inboxes.each do |inbox| %>
<% inbox_report = V2::ReportBuilder.new(Current.account, {
type: :inbox,
id: inbox.id,
since: params[:since],
until: params[:until]
}).summary %>
<% row = [ inbox.name, inbox_report[:conversations_count], (inbox_report[:avg_first_response_time]/60).to_i, (inbox_report[:avg_resolution_time]/60).to_i ] %>
<%= CSV.generate_line row %>
<% end %>