chore: rubocop
chore: fix api test conventions chore: rubocop -A spec/ chore: more rubocop -A fix failing test rubocop fixes removes helper methods that are in my opinion dead code more rubocop fixes rubocop -a --auto-gen-config
This commit is contained in:
parent
f6fb804bbe
commit
fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions
|
|
@ -27,9 +27,9 @@ class PollsController < ApplicationController
|
|||
def edit
|
||||
@poll = Poll.find(params[:id])
|
||||
|
||||
if user_has_no_right
|
||||
redirect_to polls_path, alert: t('.no_right')
|
||||
end
|
||||
return unless user_has_no_right
|
||||
|
||||
redirect_to polls_path, alert: t('.no_right')
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
@ -53,8 +53,8 @@ class PollsController < ApplicationController
|
|||
@poll.destroy
|
||||
redirect_to polls_path, notice: t('.notice')
|
||||
end
|
||||
rescue => error
|
||||
redirect_to polls_path, alert: t('.error', error: error.message)
|
||||
rescue StandardError => e
|
||||
redirect_to polls_path, alert: t('.error', error: e.message)
|
||||
end
|
||||
|
||||
def vote
|
||||
|
|
@ -73,25 +73,25 @@ class PollsController < ApplicationController
|
|||
|
||||
@poll_vote = @poll.poll_votes.where(attributes).first_or_initialize
|
||||
|
||||
if request.post?
|
||||
@poll_vote.update!(note: params[:note], user: current_user)
|
||||
return unless request.post?
|
||||
|
||||
if @poll.single_select?
|
||||
choices = {}
|
||||
choice = params[:choice]
|
||||
choices[choice] = '1' if choice
|
||||
else
|
||||
choices = params[:choices].try(:to_h) || {}
|
||||
end
|
||||
@poll_vote.update!(note: params[:note], user: current_user)
|
||||
|
||||
@poll_vote.poll_choices = choices.map do |choice, value|
|
||||
poll_choice = @poll_vote.poll_choices.where(choice: choice).first_or_initialize
|
||||
poll_choice.update!(value: value)
|
||||
poll_choice
|
||||
end
|
||||
|
||||
redirect_to @poll
|
||||
if @poll.single_select?
|
||||
choices = {}
|
||||
choice = params[:choice]
|
||||
choices[choice] = '1' if choice
|
||||
else
|
||||
choices = params[:choices].try(:to_h) || {}
|
||||
end
|
||||
|
||||
@poll_vote.poll_choices = choices.map do |choice, value|
|
||||
poll_choice = @poll_vote.poll_choices.where(choice: choice).first_or_initialize
|
||||
poll_choice.update!(value: value)
|
||||
poll_choice
|
||||
end
|
||||
|
||||
redirect_to @poll
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue