Fix line lenght offenses at multiple controllers

This commit is contained in:
Bertocq
2018-02-19 00:21:30 +01:00
parent 4fb9f6829c
commit 62d75af892
7 changed files with 34 additions and 18 deletions

View File

@@ -15,7 +15,8 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
@officer = @shift.officer
if @shift.save
redirect_to new_admin_booth_shift_path(@shift.booth), notice: t("admin.poll_shifts.flash.create")
notice = t("admin.poll_shifts.flash.create")
redirect_to new_admin_booth_shift_path(@shift.booth), notice: notice
else
load_shifts
flash[:error] = t("admin.poll_shifts.flash.date_missing")
@@ -31,7 +32,7 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
end
def search_officers
@officers = User.search(params[:search]).order(username: :asc).select { |o| o.poll_officer? == true }
@officers = User.search(params[:search]).order(username: :asc).select { |o| o.poll_officer? }
end
private
@@ -51,7 +52,9 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
end
def shift_params
shift_params = params.require(:shift).permit(:booth_id, :officer_id, :task, date: [:vote_collection_date, :recount_scrutiny_date])
date_attributes = [:vote_collection_date, :recount_scrutiny_date]
attributes = [:booth_id, :officer_id, :task, date: date_attributes]
shift_params = params.require(:shift).permit(*attributes)
shift_params.merge(date: shift_params[:date]["#{shift_params[:task]}_date".to_sym])
end
end