Class: Crm::Reports::MissedCallsController
- Inherits:
-
CrmController
- Object
- CrmController
- Crm::Reports::MissedCallsController
- Defined in:
- app/controllers/crm/reports/missed_calls_controller.rb
Overview
Controller: missed calls.
Constant Summary collapse
- ITEMS_PER_PAGE =
Items per page.
50
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/crm/reports/missed_calls_controller.rb', line 9 def show @report_command = ::Report::MissedCalls::MissedCallsCommand.new(params[:command]) @result = @report_command.execute if @report_command.success? && @result&.data.present? unfiltered = @report_command.unfiltered_data @completed_count = unfiltered.where(result_type: 'completed').count @not_completed_count = unfiltered.where.not(result_type: 'completed').count @queue_counts = @result.data.group(:queue_name).count.sort_by { |_, v| -v }.to_h @pagy, @paginated_data = pagy(:offset, @result.data, limit: ITEMS_PER_PAGE) end respond_to do |format| format.html end end |