Merge pull request #1446 from sunny-b/master
Enable Style/DotPosition Rubocop cop
This commit is contained in:
commit
fd6d0bf39b
25 changed files with 143 additions and 142 deletions
|
|
@ -21,8 +21,8 @@ module Admin
|
|||
@new_submissions = Event.where('created_at > ?', current_user.last_sign_in_at).count
|
||||
|
||||
@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
|
||||
@deactive_conferences = Conference
|
||||
.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)
|
||||
|
|
@ -106,8 +106,8 @@ module Admin
|
|||
@new_reg = @conference.registrations.where('created_at > ?', current_user.last_sign_in_at).count
|
||||
|
||||
@total_submissions = @program.events.count
|
||||
@new_submissions = @program.events.
|
||||
where('created_at > ?', current_user.last_sign_in_at).count
|
||||
@new_submissions = @program.events
|
||||
.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)
|
||||
|
|
@ -139,8 +139,8 @@ module Admin
|
|||
@event_type_distribution_confirmed = @conference.event_type_distribution(:confirmed)
|
||||
|
||||
@difficulty_levels_distribution = @conference.difficulty_levels_distribution
|
||||
@difficulty_levels_distribution_confirmed = @conference.
|
||||
difficulty_levels_distribution(:confirmed)
|
||||
@difficulty_levels_distribution_confirmed = @conference
|
||||
.difficulty_levels_distribution(:confirmed)
|
||||
|
||||
@tracks_distribution = @conference.tracks_distribution
|
||||
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ module Admin
|
|||
@events_with_requirements = @events.where.not(description: ['', nil])
|
||||
|
||||
attended_registrants_ids = @conference.registrations.where(attended: true).pluck(:user_id)
|
||||
@missing_event_speakers = EventUser.joins(:event).
|
||||
where('event_role = ? and program_id = ?', 'submitter', @program.id).
|
||||
where.not(user_id: attended_registrants_ids).
|
||||
includes(:user, :event)
|
||||
@missing_event_speakers = EventUser.joins(:event)
|
||||
.where('event_role = ? and program_id = ?', 'submitter', @program.id)
|
||||
.where.not(user_id: attended_registrants_ids)
|
||||
.includes(:user, :event)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
end
|
||||
|
||||
def registration_params
|
||||
params.require(:registration).
|
||||
permit(
|
||||
params.require(:registration)
|
||||
.permit(
|
||||
:conference_id, :arrival, :departure,
|
||||
:volunteer,
|
||||
vchoice_ids: [], qanswer_ids: [],
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ class RegistrationsController < Devise::RegistrationsController
|
|||
|
||||
def configure_permitted_parameters
|
||||
devise_parameter_sanitizer.permit(:account_update) do |u|
|
||||
u.
|
||||
permit(:email, :password, :password_confirmation, :current_password, :username, :email_public)
|
||||
u
|
||||
.permit(:email, :password, :password_confirmation, :current_password, :username, :email_public)
|
||||
end
|
||||
devise_parameter_sanitizer.permit(:sign_up) do |u|
|
||||
u.
|
||||
permit(:email, :password, :password_confirmation, :name, :username)
|
||||
u
|
||||
.permit(:email, :password, :password_confirmation, :name, :username)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -417,10 +417,10 @@ module ApplicationHelper
|
|||
# Eg: If version.changeset = '{"title"=>[nil, "Premium"], "description"=>[nil, "Premium = Super cool"], "conference_id"=>[nil, 3]}'
|
||||
# Output will be 'title, description and conference'
|
||||
def updated_attributes(version)
|
||||
version.changeset.
|
||||
reject{ |_, values| values[0].blank? && values[1].blank? }.
|
||||
keys.map{ |key| key.gsub('_id', '').tr('_', ' ')}.join(', ').
|
||||
reverse.sub(',', ' dna ').reverse
|
||||
version.changeset
|
||||
.reject{ |_, values| values[0].blank? && values[1].blank? }
|
||||
.keys.map{ |key| key.gsub('_id', '').tr('_', ' ')}.join(', ')
|
||||
.reverse.sub(',', ' dna ').reverse
|
||||
end
|
||||
|
||||
def link_to_user(user_id)
|
||||
|
|
|
|||
|
|
@ -58,16 +58,20 @@ class Cfp < ActiveRecord::Base
|
|||
private
|
||||
|
||||
def before_end_of_conference
|
||||
errors.
|
||||
add(:end_date, "can't be after the conference end date (#{program.conference.end_date})") if program.conference && program.conference.end_date && end_date && (end_date > program.conference.end_date)
|
||||
if program.conference && program.conference.end_date && end_date && (end_date > program.conference.end_date)
|
||||
errors
|
||||
.add(:end_date, "can't be after the conference end date (#{program.conference.end_date})")
|
||||
end
|
||||
|
||||
errors.
|
||||
add(:start_date, "can't be after the conference end date (#{program.conference.end_date})") if program.conference && program.conference.end_date && start_date && (start_date > program.conference.end_date)
|
||||
if program.conference && program.conference.end_date && start_date && (start_date > program.conference.end_date)
|
||||
errors
|
||||
.add(:start_date, "can't be after the conference end date (#{program.conference.end_date})")
|
||||
end
|
||||
end
|
||||
|
||||
def start_after_end_date
|
||||
errors.
|
||||
add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
|
||||
errors
|
||||
.add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
|
||||
end
|
||||
|
||||
def conference_id
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ class Conference < ActiveRecord::Base
|
|||
if registration_period &&
|
||||
registration_period.start_date &&
|
||||
registration_period.end_date
|
||||
weeks = Date.new(registration_period.start_date.year, 12, 31).
|
||||
strftime('%W').to_i
|
||||
weeks = Date.new(registration_period.start_date.year, 12, 31)
|
||||
.strftime('%W').to_i
|
||||
|
||||
result = get_registration_end_week - get_registration_start_week + 1
|
||||
end
|
||||
|
|
@ -277,9 +277,9 @@ class Conference < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +hash+ -> user: submissions
|
||||
def get_top_submitter(limit = 5)
|
||||
submitter = EventUser.joins(:event).
|
||||
where('event_role = ? and program_id = ?', 'submitter', Conference.find(id).program.id).
|
||||
limit(limit).group(:user_id)
|
||||
submitter = EventUser.joins(:event)
|
||||
.where('event_role = ? and program_id = ?', 'submitter', Conference.find(id).program.id)
|
||||
.limit(limit).group(:user_id)
|
||||
counter = submitter.order('count_all desc').count
|
||||
Conference.calculate_user_submission_hash(submitter, counter)
|
||||
end
|
||||
|
|
@ -461,13 +461,13 @@ class Conference < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +ActiveRecord+
|
||||
def self.get_active_conferences_for_dashboard
|
||||
result = Conference.where('start_date > ?', Time.now).
|
||||
select('id, short_title, color, start_date')
|
||||
result = Conference.where('start_date > ?', Time.now)
|
||||
.select('id, short_title, color, start_date')
|
||||
|
||||
if result.empty?
|
||||
result = Conference.
|
||||
select('id, short_title, color, start_date').limit(2).
|
||||
order(start_date: :desc)
|
||||
result = Conference
|
||||
.select('id, short_title, color, start_date').limit(2)
|
||||
.order(start_date: :desc)
|
||||
end
|
||||
result
|
||||
end
|
||||
|
|
|
|||
|
|
@ -286,8 +286,8 @@ class Event < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def before_end_of_conference
|
||||
errors.
|
||||
add(:created_at, "can't be after the conference end date!") if program.conference && program.conference.end_date &&
|
||||
errors
|
||||
.add(:created_at, "can't be after the conference end date!") if program.conference && program.conference.end_date &&
|
||||
(Date.today > program.conference.end_date)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@ class RegistrationPeriod < ActiveRecord::Base
|
|||
private
|
||||
|
||||
def before_end_of_conference
|
||||
errors.
|
||||
add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && start_date && (start_date > conference.end_date)
|
||||
errors
|
||||
.add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && start_date && (start_date > conference.end_date)
|
||||
|
||||
errors.
|
||||
add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && end_date && (end_date > conference.end_date)
|
||||
errors
|
||||
.add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && end_date && (end_date > conference.end_date)
|
||||
end
|
||||
|
||||
def start_date_before_end_date
|
||||
errors.
|
||||
add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
|
||||
errors
|
||||
.add(:start_date, "can't be after the end date") if start_date && end_date && start_date > end_date
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue