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

View file

@ -71,8 +71,10 @@ class EventAttachmentsController < ApplicationController
:content_type => 'text/html',
:layout => false
}
format.json { render json: [@upload.to_jq_upload].to_json, status: :created,
location: conference_proposal_event_attachment_path(@upload.event.conference.short_title, @upload.event, @upload) }
format.json do
render json: [@upload.to_jq_upload].to_json, status: :created,
location: conference_proposal_event_attachment_path(@upload.event.conference.short_title, @upload.event, @upload)
end
else
format.html { render action: "new" }
format.json { render json: @upload.errors, status: :unprocessable_entity }

View file

@ -1,5 +1,4 @@
class ScheduleController < ApplicationController
layout "application"
def index
@ -14,5 +13,4 @@ class ScheduleController < ApplicationController
@today = @conference.start_date.strftime("%Y-%m-%d")
end
end
end

View file

@ -13,7 +13,7 @@ module Users
openid = Openid.find_for_oauth(auth_hash) # Get or create openid
# If openid exists and is associated with a user, sign in with associated user,
# even if the email of the associated user and the email of the provided openid are different
unless user = openid.user
unless (user = openid.user)
user = User.find_for_auth(auth_hash, current_user) # Get or create users
end