feat: Include resolution time and waiting time in team & agent report export (#9296)

This commit is contained in:
Shivam Mishra
2024-05-03 05:59:52 +05:30
committed by GitHub
parent 9e8a626598
commit b24626a65a
4 changed files with 21 additions and 7 deletions

View File

@@ -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

View File

@@ -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 -%>

View File

@@ -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 -%>

View File

@@ -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: