diff --git a/app/helpers/api/v2/accounts/reports_helper.rb b/app/helpers/api/v2/accounts/reports_helper.rb index 74c7af43e..4d5a6f115 100644 --- a/app/helpers/api/v2/accounts/reports_helper.rb +++ b/app/helpers/api/v2/accounts/reports_helper.rb @@ -1,7 +1,7 @@ module Api::V2::Accounts::ReportsHelper def generate_agents_report Current.account.users.map do |agent| - agent_report = generate_report({ type: :agent, id: agent.id }) + agent_report = report_builder({ type: :agent, id: agent.id }).summary [agent.name] + generate_readable_report_metrics(agent_report) end end @@ -15,7 +15,7 @@ module Api::V2::Accounts::ReportsHelper def generate_teams_report Current.account.teams.map do |team| - team_report = generate_report({ type: :team, id: team.id }) + team_report = report_builder({ type: :team, id: team.id }).summary [team.name] + generate_readable_report_metrics(team_report) end end @@ -27,7 +27,7 @@ module Api::V2::Accounts::ReportsHelper end end - def generate_report(report_params) + def report_builder(report_params) V2::ReportBuilder.new( Current.account, report_params.merge( @@ -37,7 +37,11 @@ module Api::V2::Accounts::ReportsHelper business_hours: ActiveModel::Type::Boolean.new.cast(params[:business_hours]) } ) - ).short_summary + ) + end + + def generate_report(report_params) + report_builder(report_params).short_summary end private @@ -46,7 +50,9 @@ module Api::V2::Accounts::ReportsHelper [ report_metric[:conversations_count], Reports::TimeFormatPresenter.new(report_metric[:avg_first_response_time]).format, - Reports::TimeFormatPresenter.new(report_metric[:avg_resolution_time]).format + Reports::TimeFormatPresenter.new(report_metric[:avg_resolution_time]).format, + Reports::TimeFormatPresenter.new(report_metric[:reply_time]).format, + report_metric[:resolutions_count] ] end end diff --git a/app/views/api/v2/accounts/reports/agents.csv.erb b/app/views/api/v2/accounts/reports/agents.csv.erb index dfc90f016..3b5d765f1 100644 --- a/app/views/api/v2/accounts/reports/agents.csv.erb +++ b/app/views/api/v2/accounts/reports/agents.csv.erb @@ -4,7 +4,9 @@ I18n.t('reports.agent_csv.agent_name'), I18n.t('reports.agent_csv.conversations_count'), I18n.t('reports.agent_csv.avg_first_response_time'), - I18n.t('reports.agent_csv.avg_resolution_time') + I18n.t('reports.agent_csv.avg_resolution_time'), + I18n.t('reports.agent_csv.avg_customer_waiting_time'), + I18n.t('reports.agent_csv.resolution_count') ] %> <%= CSVSafe.generate_line headers -%> diff --git a/app/views/api/v2/accounts/reports/teams.csv.erb b/app/views/api/v2/accounts/reports/teams.csv.erb index 1c2e6084a..6ba4a001f 100644 --- a/app/views/api/v2/accounts/reports/teams.csv.erb +++ b/app/views/api/v2/accounts/reports/teams.csv.erb @@ -4,7 +4,9 @@ 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') + I18n.t('reports.team_csv.avg_resolution_time'), + I18n.t('reports.team_csv.avg_customer_waiting_time'), + I18n.t('reports.team_csv.resolution_count') ] %> <%= CSVSafe.generate_line headers -%> diff --git a/config/locales/en.yml b/config/locales/en.yml index 92c56574d..44c4d76cb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -88,6 +88,8 @@ en: conversations_count: Assigned conversations avg_first_response_time: Avg first response time avg_resolution_time: Avg resolution time + resolution_count: Resolution Count + avg_customer_waiting_time: Avg customer waiting time inbox_csv: inbox_name: Inbox name inbox_type: Inbox type @@ -104,6 +106,8 @@ en: conversations_count: Conversations count avg_first_response_time: Avg first response time avg_resolution_time: Avg resolution time + resolution_count: Resolution Count + avg_customer_waiting_time: Avg customer waiting time conversation_traffic_csv: timezone: Timezone sla_csv: