feat: Add business hours in downloadable reports (#4674)

Co-authored-by: Aswin Dev P.S <aswindevps@gmail.com>
This commit is contained in:
Pranav Raj S
2022-05-27 09:26:59 +05:30
committed by GitHub
parent dceeb57a1d
commit 52fad886b8
13 changed files with 138 additions and 67 deletions

View File

@@ -6,14 +6,7 @@
]
%>
<%= 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 ] %>
<% @report_data.each do |row| %>
<%= CSV.generate_line row -%>
<% end %>
<%= CSV.generate_line [I18n.t('reports.period', since: Date.strptime(params[:since], '%s'), until: Date.strptime(params[:until], '%s'))] %>

View File

@@ -1,12 +1,13 @@
<% headers = ['Inbox name', 'Conversations count', 'Avg first response time (Minutes)', 'Avg resolution time (Minutes)'] %>
<% headers = [
I18n.t('reports.inbox_csv.inbox_name'),
I18n.t('reports.inbox_csv.inbox_type'),
I18n.t('reports.inbox_csv.conversations_count'),
I18n.t('reports.inbox_csv.avg_first_response_time'),
I18n.t('reports.inbox_csv.avg_resolution_time')
]
%>
<%= 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 ] %>
<% @report_data.each do |row| %>
<%= CSV.generate_line row -%>
<% end %>
<%= CSV.generate_line [I18n.t('reports.period', since: Date.strptime(params[:since], '%s'), until: Date.strptime(params[:until], '%s'))] %>

View File

@@ -1,12 +1,12 @@
<% headers = ['Label Title', 'Conversations count', 'Avg first response time (Minutes)', 'Avg resolution time (Minutes)'] %>
<% headers = [
I18n.t('reports.label_csv.label_title'),
I18n.t('reports.label_csv.conversations_count'),
I18n.t('reports.label_csv.avg_first_response_time'),
I18n.t('reports.label_csv.avg_resolution_time')
]
%>
<%= CSV.generate_line headers -%>
<% Current.account.labels.each do |label| %>
<% label_report = V2::ReportBuilder.new(Current.account, {
type: :label,
id: label.id,
since: params[:since],
until: params[:until]
}).summary %>
<% row = [ label.title, label_report[:conversations_count], (label_report[:avg_first_response_time]/60).to_i, (label_report[:avg_resolution_time]/60).to_i ] %>
<% @report_data.each do |row| %>
<%= CSV.generate_line row -%>
<% end %>
<%= CSV.generate_line [I18n.t('reports.period', since: Date.strptime(params[:since], '%s'), until: Date.strptime(params[:until], '%s'))] %>

View File

@@ -6,14 +6,7 @@
]
%>
<%= CSV.generate_line headers -%>
<% Current.account.teams.each do |team| %>
<% team_report = V2::ReportBuilder.new(Current.account, {
type: :team,
id: team.id,
since: params[:since],
until: params[:until]
}).summary %>
<% row = [ team.name, team_report[:conversations_count], (team_report[:avg_first_response_time]/60).to_i, (team_report[:avg_resolution_time]/60).to_i ] %>
<% @report_data.each do |row| %>
<%= CSV.generate_line row -%>
<% end %>
<%= CSV.generate_line [I18n.t('reports.period', since: Date.strptime(params[:since], '%s'), until: Date.strptime(params[:until], '%s'))] %>