Class: Crm::Reports::TechProductivityController

Inherits:
CrmController
  • Object
show all
Includes:
Controllers::ReportCommandFlashable
Defined in:
app/controllers/crm/reports/tech_productivity_controller.rb

Overview

Technical-support productivity report: call-log volume and outcomes by
employee/department over a date range. Non-managers are scoped to their
own call logs; admins and technical support managers see everyone's.

Instance Method Summary collapse

Instance Method Details

#showvoid

This method returns an undefined value.

Runs the tech-productivity report command, scoping to the current user's
own calls unless they hold an admin/manager role.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/crm/reports/tech_productivity_controller.rb', line 15

def show
  authorize! :read, CallLog
  command_attrs = tech_productivity_command_params
  unless helpers.user_has_role?(%w[admin technical_support_manager])
    command_attrs[:employee_ids] = [current_user.id.to_s] if command_attrs.present?
  end
  @report_command = ::Report::TechProductivity::TechProductivityCommand.new(command_attrs)
  @results = @report_command.execute

  flash_report_command_errors
  respond_to do |format|
    format.html
    format.turbo_stream
  end
end