Fix Style/ConditionalAssignment errors

They did not get excluded by `--auto-gen-config`
This commit is contained in:
Hernan Schmidt 2017-07-14 14:12:54 +02:00 committed by Hernán Schmidt
parent 523203ac74
commit d9a3b0de72
5 changed files with 31 additions and 31 deletions

View file

@ -13,11 +13,11 @@ module Admin
def show
if can_manage_volunteers?(@conference)
if @conference.use_vpositions
@volunteers = @conference.registrations.joins(:vchoices).uniq
else
@volunteers = @conference.registrations.where(volunteer: true)
end
@volunteers = if @conference.use_vpositions
@conference.registrations.joins(:vchoices).uniq
else
@conference.registrations.where(volunteer: true)
end
else
authorize! :index, :volunteer
end

View file

@ -38,12 +38,12 @@ class ConferenceRegistrationsController < ApplicationController
def create
@registration = @conference.registrations.new(registration_params)
if current_user.nil?
# @user variable needs to be set so that _sign_up_form_embedded works properly
@user = @registration.build_user(user_params)
else
@user = current_user
end
@user = if current_user.nil?
# @user variable needs to be set so that _sign_up_form_embedded works properly
@registration.build_user(user_params)
else
current_user
end
@registration.user = @user
authorize! :create, @registration

View file

@ -563,11 +563,11 @@ class Conference < ActiveRecord::Base
# ====Returns
# * +hash+ -> track => {color, value}
def tracks_distribution(state = nil)
if state
tracks_grouped = program.events.select(:track_id).where('state = ?', state).group(:track_id)
else
tracks_grouped = program.events.select(:track_id).group(:track_id)
end
tracks_grouped = if state
program.events.select(:track_id).where('state = ?', state).group(:track_id)
else
program.events.select(:track_id).group(:track_id)
end
tracks_counted = tracks_grouped.count
calculate_track_distribution_hash(tracks_grouped, tracks_counted)
@ -1001,11 +1001,11 @@ class Conference < ActiveRecord::Base
# ====Returns
# * +hash+ -> object_type => {color, value}
def calculate_event_distribution(group_by_id, association_symbol, state = nil)
if state
grouped = program.events.select(group_by_id).where('state = ?', 'confirmed').group(group_by_id)
else
grouped = program.events.select(group_by_id).group(group_by_id)
end
grouped = if state
program.events.select(group_by_id).where('state = ?', 'confirmed').group(group_by_id)
else
program.events.select(group_by_id).group(group_by_id)
end
counted = grouped.count
calculate_distribution_hash(grouped, counted, association_symbol)

View file

@ -29,11 +29,11 @@ class TicketPurchase < ActiveRecord::Base
conference.tickets.each do |ticket|
quantity = purchases[ticket.id.to_s].to_i
# if the user bought the ticket and is still unpaid, just update the quantity
if ticket.bought?(user) && ticket.unpaid?(user)
purchase = update_quantity(conference, quantity, ticket, user)
else
purchase = purchase_ticket(conference, quantity, ticket, user)
end
purchase = if ticket.bought?(user) && ticket.unpaid?(user)
update_quantity(conference, quantity, ticket, user)
else
purchase_ticket(conference, quantity, ticket, user)
end
if purchase && !purchase.save
errors.push(purchase.errors.full_messages)

View file

@ -30,13 +30,13 @@ class User < ActiveRecord::Base
# :lockable, :timeoutable and :omniauthable
devise_modules = []
if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
devise_modules += [:ichain_authenticatable, :ichain_registerable, :omniauthable, omniauth_providers: []]
else
devise_modules += [:database_authenticatable, :registerable,
devise_modules += if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
[:ichain_authenticatable, :ichain_registerable, :omniauthable, omniauth_providers: []]
else
[:database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable,
:omniauthable, omniauth_providers: [:suse, :google, :facebook, :github]]
end
end
devise(*devise_modules)