Fix basic style issues with rubocop

This commit is contained in:
Artem Chernikov 2014-07-21 14:27:32 +02:00
parent f4a22851a1
commit 763f864dc9
36 changed files with 108 additions and 143 deletions

View file

@ -25,6 +25,5 @@ class Admin::DifficultyLevelsController < ApplicationController
flash[:error] = "Difficulty Levels update failed."
redirect_to(admin_conference_difficulty_levels_path(:conference_id => @conference.short_title))
end
end
end

View file

@ -18,7 +18,7 @@ module Admin
@mystates = []
@mytypes = []
@eventstats = Hash.new
@eventstats = {}
@totallength = 0
@machine_states.each do |mystate|
@ -50,7 +50,7 @@ module Admin
@totallength += myevent.event_type.length
end
if @eventstats[mytype.title] == nil
if @eventstats[mytype.title].nil?
@eventstats[mytype.title] = { 'count' => events_mytype.count,
'length' => events_mytype.count * mytype.length }
end
@ -150,7 +150,7 @@ module Admin
@event = Event.find(params[:id])
@ratings = @event.votes.includes(:user)
if votes = current_user.votes.find_by_event_id(params[:id])
if (votes = current_user.votes.find_by_event_id(params[:id]))
votes.update_attributes(rating: params[:rating])
else
@myvote = @event.votes.build

View file

@ -79,7 +79,7 @@ class Admin::QuestionsController < ApplicationController
a.delete
end
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map {|a| a.title}.join ','}"
end
end
rescue ActiveRecord::RecordInvalid
flash[:error] = "Could not delete question."
end
@ -91,6 +91,6 @@ class Admin::QuestionsController < ApplicationController
end
@questions = Question.where(:global => true).all | Question.where(:conference_id => @conference.id)
@questions_conference = @conference.questions
@questions_conference = @conference.questions
end
end

View file

@ -11,7 +11,5 @@ class Admin::SocialEventsController < ApplicationController
else
redirect_to(admin_conference_social_events_path(:conference_id => @conference.short_title), :notice => 'Social events update failed.')
end
end
end

View file

@ -48,7 +48,7 @@ module Admin
if @events.count > 0
start_date = @events.minimum('created_at').strftime('%Y-%m-%d')
end_date = @events.maximum('created_at').strftime('%Y-%m-%d')
unless start_date == nil || end_date == nil
unless start_date.nil? || end_date.nil?
@events_time = var_time(start_date, end_date, @events, 'created_at')
end
end
@ -87,7 +87,7 @@ module Admin
typelength += myevent.event_type.length
@totallength += myevent.event_type.length
end
if @eventstats[mytype.title] == nil
if @eventstats[mytype.title].nil?
@eventstats[mytype.title] = { 'count' => events_mytype.count,
'length' => events_mytype.count * mytype.length }
end

View file

@ -19,5 +19,4 @@ class Admin::VenueController < ApplicationController
@venue = @conference.venue
render :venue_info
end
end