Update records
This commit is contained in:
@@ -11,13 +11,11 @@ class Api::V2::Accounts::ReportsController < Api::V1::Accounts::BaseController
|
||||
end
|
||||
|
||||
def summary
|
||||
render json: summary_metrics
|
||||
render json: build_summary(:summary)
|
||||
end
|
||||
|
||||
def bot_summary
|
||||
summary = V2::NewReportBuilder.new(Current.account, current_summary_params).bot_summary
|
||||
summary[:previous] = V2::ReportBuilder.new(Current.account, previous_summary_params).bot_summary
|
||||
render json: summary
|
||||
render json: build_summary(:bot_summary)
|
||||
end
|
||||
|
||||
def agents
|
||||
@@ -51,9 +49,9 @@ class Api::V2::Accounts::ReportsController < Api::V1::Accounts::BaseController
|
||||
def conversations
|
||||
case params[:type].to_sym
|
||||
when :account
|
||||
render json: V2::LiveReports::AccountReportsBuilder.new(Current.account).build
|
||||
render json: V2::Reports::LiveReports::AccountReportsBuilder.new(Current.account).build
|
||||
when :agent
|
||||
render json: V2::LiveReports::AgentReportsBuilder.new(Current.account, conversation_params).build
|
||||
render json: V2::Reports::LiveReports::AgentReportsBuilder.new(Current.account, conversation_params).build
|
||||
else
|
||||
head :unprocessable_entity
|
||||
end
|
||||
@@ -127,9 +125,10 @@ class Api::V2::Accounts::ReportsController < Api::V1::Accounts::BaseController
|
||||
}
|
||||
end
|
||||
|
||||
def summary_metrics
|
||||
summary = V2::ReportBuilder.new(Current.account, current_summary_params).summary
|
||||
summary[:previous] = V2::ReportBuilder.new(Current.account, previous_summary_params).summary
|
||||
summary
|
||||
def build_summary(method)
|
||||
builder = V2::ConversationMetricBuilder
|
||||
current_summary = builder.new(Current.account, current_summary_params).send(method)
|
||||
previous_summary = builder.new(Current.account, previous_summary_params).send(method)
|
||||
current_summary.merge(previous: previous_summary)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user