Updated

app/controllers/admin / tasks_controller.rb

A
28 lines of codes
4 methods
3.8 complexity/method
1 churn
15.22 complexity
0 duplications
class Admin::TasksController < Admin::AdminController
  1. Admin::TasksController has no descriptive comment
before_action :require_sysadmin before_action :redirect_to_tasks_tab, if: :missing_tasks? def create if Admin::TaskRunner.run(params) notice = [:started_tasks, count: selected_tasks.size] else notice = [:failed_tasks] end redirect_to edit_admin_site_path(tab: "tasks"), notice: notice end private def redirect_to_tasks_tab redirect_to edit_admin_site_path(tab: "tasks"), notice: :missing_tasks end def missing_tasks? selected_tasks.empty? end def selected_tasks Array(params[:tasks]) end end