feat: API to Filter reports by teams (#3066)
Add API to Filter reports by teams Fixes: #2916
This commit is contained in:
19
app/views/api/v2/accounts/reports/teams.csv.erb
Normal file
19
app/views/api/v2/accounts/reports/teams.csv.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<% headers = [
|
||||
I18n.t('reports.team_csv.team_name'),
|
||||
I18n.t('reports.team_csv.conversations_count'),
|
||||
I18n.t('reports.team_csv.avg_first_response_time'),
|
||||
I18n.t('reports.team_csv.avg_resolution_time')
|
||||
]
|
||||
%>
|
||||
<%= 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 ] %>
|
||||
<%= CSV.generate_line row %>
|
||||
<% end %>
|
||||
<%= CSV.generate_line [I18n.t('reports.period', since: Date.strptime(params[:since], '%s'), until: Date.strptime(params[:until], '%s'))] %>
|
||||
Reference in New Issue
Block a user