rubocop files update and auto correction

This commit is contained in:
raluka 2015-10-21 17:33:53 +02:00
parent 1a62dc930e
commit 1f82fbbdc6
88 changed files with 519 additions and 452 deletions

View file

@ -22,7 +22,7 @@ module Admin
# Grouping all comments by conference, and by event. It returns {:conference => {:event => [{comment_2}, {comment_1 }]}}
def grouped_comments(remarks)
remarks.group_by{ |comment| comment.commentable.conference }.map {|conference, comments| [conference, comments.group_by{|comment| comment.commentable}]}.to_h
remarks.group_by{ |comment| comment.commentable.conference }.map {|conference, comments| [conference, comments.group_by(&:commentable)]}.to_h
end
end
end

View file

@ -21,7 +21,7 @@ module Admin
@active_conferences = Conference.get_active_conferences_for_dashboard # pending or the last two
@deactive_conferences = Conference.
get_conferences_without_active_for_dashboard(@active_conferences) # conferences without active
get_conferences_without_active_for_dashboard(@active_conferences) # conferences without active
@conferences = @active_conferences + @deactive_conferences
@recent_users = User.limit(5).order(created_at: :desc)
@ -102,7 +102,7 @@ module Admin
@total_submissions = @conference.events.count
@new_submissions = @conference.events.
where('created_at > ?', current_user.last_sign_in_at).count
where('created_at > ?', current_user.last_sign_in_at).count
@program_length = @conference.current_program_hours
@new_program_length = @conference.new_program_hours(current_user.last_sign_in_at)
@ -135,7 +135,7 @@ module Admin
@difficulty_levels_distribution = @conference.difficulty_levels_distribution
@difficulty_levels_distribution_confirmed = @conference.
difficulty_levels_distribution(:confirmed)
difficulty_levels_distribution(:confirmed)
@tracks_distribution = @conference.tracks_distribution
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)

View file

@ -6,7 +6,7 @@ module Admin
def update
@conference.email_settings.update_attributes(params[:email_settings])
redirect_to(admin_conference_emails_path(
@conference.short_title),
@conference.short_title),
notice: 'Settings have been successfully updated.')
end

View file

@ -106,7 +106,7 @@ module Admin
def update
if @event.submitter.update_attributes(params[:user]) &&
@event.update_attributes(params[:event])
@event.update_attributes(params[:event])
if request.xhr?
render js: 'index'

View file

@ -73,12 +73,9 @@ module Admin
# Delete question and its answers
begin
Question.transaction do
@question.destroy
@question.answers.each do |a|
a.destroy
end
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map {|a| a.title}.join ','}"
@question.answers.each(&:destroy)
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map(&:title).join ','}"
end
rescue ActiveRecord::RecordInvalid
flash[:error] = 'Could not delete question.'

View file

@ -53,14 +53,14 @@ module Admin
def registration_params
params.require(:registration).
permit(
:conference_id, :arrival, :departure,
:volunteer,
vchoice_ids: [], qanswer_ids: [], event_ids: [],
qanswers_attributes: [],
user_attributes: [
:id, :name, :tshirt, :mobile, :volunteer_experience, :languages,
:nickname, :affiliation])
permit(
:conference_id, :arrival, :departure,
:volunteer,
vchoice_ids: [], qanswer_ids: [], event_ids: [],
qanswers_attributes: [],
user_attributes: [
:id, :name, :tshirt, :mobile, :volunteer_experience, :languages,
:nickname, :affiliation])
end
end
end

View file

@ -27,7 +27,7 @@ module Admin
def update
if @sponsor.update_attributes(sponsor_params)
redirect_to(admin_conference_sponsors_path(
conference_id: @conference.short_title),
conference_id: @conference.short_title),
notice: 'Sponsor successfully updated.')
else
flash[:error] = "Update sponsor failed: #{@sponsor.errors.full_messages.join('. ')}."

View file

@ -27,7 +27,7 @@ module Admin
def update
if @sponsorship_level.update_attributes(sponsorship_level_params)
redirect_to(admin_conference_sponsorship_levels_path(
conference_id: @conference.short_title),
conference_id: @conference.short_title),
notice: 'Sponsorship level successfully updated.')
else
flash[:error] = "Update Sponsorship level failed: #{@sponsorship_level.errors.full_messages.join('. ')}."