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 def show
if can_manage_volunteers?(@conference) if can_manage_volunteers?(@conference)
if @conference.use_vpositions @volunteers = if @conference.use_vpositions
@volunteers = @conference.registrations.joins(:vchoices).uniq @conference.registrations.joins(:vchoices).uniq
else else
@volunteers = @conference.registrations.where(volunteer: true) @conference.registrations.where(volunteer: true)
end end
else else
authorize! :index, :volunteer authorize! :index, :volunteer
end end

View file

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

View file

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

View file

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

View file

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