Rubocop autocorrections

This commit is contained in:
James Mason 2018-11-13 18:01:49 -08:00
parent 299738f58d
commit 43bef689fc
85 changed files with 622 additions and 578 deletions

View file

@ -13,6 +13,7 @@ class MigrateDataPersonToUser < ActiveRecord::Migration
TempPerson.all.each do |p|
user = TempUser.find_by(id: p.user_id)
next unless user
if p.public_name.empty?
user.name = p.email
else

View file

@ -27,12 +27,12 @@ class AddEventsPerWeekToConference < ActiveRecord::Migration
week = event_version.created_at.end_of_week
no_events = {
new: 0,
withdrawn: 0,
new: 0,
withdrawn: 0,
unconfirmed: 0,
confirmed: 0,
canceled: 0,
rejected: 0,
confirmed: 0,
canceled: 0,
rejected: 0,
}
if !conference.events_per_week

View file

@ -13,13 +13,13 @@ class MoveConferenceContactDetailsToContact < ActiveRecord::Migration
# Move all the settings to the new object
TempConference.all.each do |conference|
unless TempContact.exists?(conference_id: conference.id)
TempContact.create(social_tag: conference.social_tag,
email: conference.contact_email,
facebook: conference.facebook_url,
googleplus: conference.google_url,
twitter: conference.twitter_url,
instagram: conference.instagram_url,
public: conference.include_social_media_in_splash,
TempContact.create(social_tag: conference.social_tag,
email: conference.contact_email,
facebook: conference.facebook_url,
googleplus: conference.google_url,
twitter: conference.twitter_url,
instagram: conference.instagram_url,
public: conference.include_social_media_in_splash,
conference_id: conference.id)
end
end

View file

@ -14,9 +14,9 @@ class MoveConferenceMediaToCommercial < ActiveRecord::Migration
TempConference.all.each do |conference|
unless TempCommercial.exists?(commercialable_id: conference.id, commercialable_id: 'Conference')
unless conference.media_id.blank? || conference.media_type.blank?
TempCommercial.create(commercial_id: conference.media_id,
commercial_type: conference.media_type,
commercialable_id: conference.id,
TempCommercial.create(commercial_id: conference.media_id,
commercial_type: conference.media_type,
commercialable_id: conference.id,
commercialable_type: 'Conference')
end
end

View file

@ -14,9 +14,9 @@ class MoveEventMediaToCommercial < ActiveRecord::Migration
TempEvent.all.each do |event|
unless TempCommercial.exists?(commercialable_id: event.id, commercialable_id: 'Conference')
unless event.media_id.blank? || event.media_type.blank?
TempCommercial.create(commercial_id: event.media_id,
commercial_type: event.media_type,
commercialable_id: event.id,
TempCommercial.create(commercial_id: event.media_id,
commercial_type: event.media_type,
commercialable_id: event.id,
commercialable_type: 'Event')
end
end

View file

@ -14,9 +14,9 @@ class MoveConferenceRegistrationDataToRegistrationPeriods < ActiveRecord::Migrat
TempConference.all.each do |conference|
unless TempRegistrationPeriod.exists?(conference_id: conference.id)
TempRegistrationPeriod.create(conference_id: conference.id,
start_date: conference.registration_start_date,
end_date: conference.registration_end_date,
description: conference.registration_description)
start_date: conference.registration_start_date,
end_date: conference.registration_end_date,
description: conference.registration_description)
end
end

View file

@ -41,8 +41,8 @@ class MigratingSupporterRegistrationsToTicketUsers < ActiveRecord::Migration
# Sum up if a user has bought more than one ticket
TempSupporterRegistrations.all.each do |s|
sup_reg = TempSupporterRegistrations.where(
ticket_id: s.ticket_id,
user_id: s.user_id,
ticket_id: s.ticket_id,
user_id: s.user_id,
conference_id: s.conference_id)
quantity = sup_reg.count

View file

@ -25,22 +25,22 @@ class MoveSplashpageAttributesFromConferenceToSplashpage < ActiveRecord::Migrati
# Copy values to splashpage
TempConference.all.each do |conference|
unless TempSplashpage.exists?(conference_id: conference.id)
splash = TempSplashpage.create(conference_id: conference.id,
public: conference.make_conference_public,
include_registrations: conference.include_registrations_in_splash,
include_tracks: conference.include_tracks_in_splash,
include_program: conference.include_program_in_splash,
include_banner: conference.include_banner_in_splash,
include_tickets: conference.include_tickets_in_splash,
ticket_description: conference.ticket_description,
include_sponsors: conference.include_sponsors_in_splash,
sponsor_description: conference.sponsor_description,
lodging_description: conference.lodging_description,
banner_description: conference.description,
banner_photo_file_name: conference.banner_photo_file_name,
splash = TempSplashpage.create(conference_id: conference.id,
public: conference.make_conference_public,
include_registrations: conference.include_registrations_in_splash,
include_tracks: conference.include_tracks_in_splash,
include_program: conference.include_program_in_splash,
include_banner: conference.include_banner_in_splash,
include_tickets: conference.include_tickets_in_splash,
ticket_description: conference.ticket_description,
include_sponsors: conference.include_sponsors_in_splash,
sponsor_description: conference.sponsor_description,
lodging_description: conference.lodging_description,
banner_description: conference.description,
banner_photo_file_name: conference.banner_photo_file_name,
banner_photo_content_type: conference.banner_photo_content_type,
banner_photo_file_size: conference.banner_photo_file_size,
banner_photo_updated_at: conference.banner_photo_updated_at)
banner_photo_file_size: conference.banner_photo_file_size,
banner_photo_updated_at: conference.banner_photo_updated_at)
contact = TempContact.find_by(conference_id: conference.id)
if contact

View file

@ -18,7 +18,7 @@ class MoveSponsorEmailToContact < ActiveRecord::Migration
contact.sponsor_email = conference.sponsor_email
contact.save
else
Contact.create(conference_id: conference.id,
Contact.create(conference_id: conference.id,
sponsors_email: conference.sponsor_email)
end
end

View file

@ -58,9 +58,9 @@ class AddRequireHandicappedAccessToQuestions < ActiveRecord::Migration
answer_no = TempAnswer.find_or_create_by!(title: 'No')
# Find existing question or initialize it
q = TempQuestion.find_or_initialize_by(title: 'Do you need handicapped access?',
q = TempQuestion.find_or_initialize_by(title: 'Do you need handicapped access?',
question_type_id: qtype.id,
global: true)
global: true)
# Save question
q.save!

View file

@ -58,9 +58,9 @@ class AddAttendingWithPartnerToQuestions < ActiveRecord::Migration
answer_no = TempAnswer.find_or_create_by!(title: 'No')
# Find existing question or initialize it
q = TempQuestion.find_or_initialize_by(title: 'Will you attend with a partner?',
q = TempQuestion.find_or_initialize_by(title: 'Will you attend with a partner?',
question_type_id: qtype.id,
global: true)
global: true)
# Save question
q.save!

View file

@ -58,9 +58,9 @@ class AddStayingAtSuggestedHotelToQuestions < ActiveRecord::Migration
answer_no = TempAnswer.find_or_create_by!(title: 'No')
# Find existing question or initialize it
q = TempQuestion.find_or_initialize_by(title: 'Will you stay at one of the suggested hotels?',
q = TempQuestion.find_or_initialize_by(title: 'Will you stay at one of the suggested hotels?',
question_type_id: qtype.id,
global: true)
global: true)
# Save question
q.save!

View file

@ -58,9 +58,9 @@ class AddAttendingSocialEventsToQuestions < ActiveRecord::Migration
answer_no = TempAnswer.find_or_create_by!(title: 'No')
# Find existing question or initialize it
q = TempQuestion.find_or_initialize_by(title: 'Will you attend the social event(s)?',
q = TempQuestion.find_or_initialize_by(title: 'Will you attend the social event(s)?',
question_type_id: qtype.id,
global: true)
global: true)
# Save question
q.save!

View file

@ -74,27 +74,27 @@ class RemoveSocialEventsTable < ActiveRecord::Migration
TempConference.all.each do |conference|
if TempSocialEvent.where(conference_id: conference.id).any?
# Find existing question or initialize it
question = TempQuestion.find_or_initialize_by(title: 'Which of the following social events are you going to attend?',
conference_id: conference.id,
question = TempQuestion.find_or_initialize_by(title: 'Which of the following social events are you going to attend?',
conference_id: conference.id,
question_type_id: qtype.id)
question.save!
# Enable the question for the conference
TempConferencesQuestions.find_or_create_by!(conference_id: conference.id,
question_id: question.id)
question_id: question.id)
end
TempSocialEvent.where(conference_id: conference.id).each do |social_event|
answer = TempAnswer.find_or_create_by!(title: social_event.title)
# Associate answer with the question
qa = TempQanswer.find_or_initialize_by(question_id: question.id,
answer_id: answer.id)
answer_id: answer.id)
qa.save!
# Associate appropriate answer with registration
TempRegistrationsSocialEvent.where(social_event_id: social_event.id).each do |registration_social_event|
registration = TempRegistration.find(registration_social_event.registration_id)
TempQanswerRegistration.find_or_create_by!(registration_id: registration.id,
qanswer_id: qa.id)
qanswer_id: qa.id)
end
end
end
@ -124,7 +124,7 @@ class RemoveSocialEventsTable < ActiveRecord::Migration
TempQanswerRegistration.where(qanswer_id: qa.id).each do |qa_registration|
answer = TempAnswer.find(qa.answer_id)
registration = TempRegistration.find(qa_registration.registration_id)
social_event = TempSocialEvent.find_or_create_by!(title: answer.title,
social_event = TempSocialEvent.find_or_create_by!(title: answer.title,
conference_id: conference.id)
TempRegistrationsSocialEvent.find_or_create_by!(registration_id: registration.id,
social_event_id: social_event.id)

View file

@ -67,25 +67,25 @@ class RemoveDietaryChoicesTable < ActiveRecord::Migration
TempConference.all.each do |conference|
if TempDietaryChoice.where(conference_id: conference.id).any?
# Find existing question or initialize it
question = TempQuestion.find_or_initialize_by(title: 'Which is your dietary choice?',
conference_id: conference.id,
question = TempQuestion.find_or_initialize_by(title: 'Which is your dietary choice?',
conference_id: conference.id,
question_type_id: qtype.id)
question.save!
# Enable the question for the conference
TempConferencesQuestions.find_or_create_by!(conference_id: conference.id,
question_id: question.id)
question_id: question.id)
TempDietaryChoice.where(conference_id: conference.id).each do |dietary_choice|
answer = TempAnswer.find_or_create_by!(title: dietary_choice.title)
# Associate answer with the question
qa = TempQanswer.find_or_initialize_by(question_id: question.id,
answer_id: answer.id)
answer_id: answer.id)
qa.save!
# Associate appropriate answer with registration
TempRegistration.where(dietary_choice_id: dietary_choice.id).each do |registration|
TempQanswerRegistration.find_or_create_by!(registration_id: registration.id,
qanswer_id: qa.id)
qanswer_id: qa.id)
end
end
end
@ -96,26 +96,26 @@ class RemoveDietaryChoicesTable < ActiveRecord::Migration
if registration.other_dietary_choice.present?
conference = TempConference.find(registration.conference_id)
qtype = TempQuestionType.find_or_create_by!(title: 'Yes/No')
question = TempQuestion.find_or_initialize_by(title: 'Do you have another dietary choice?',
conference_id: conference.id,
question = TempQuestion.find_or_initialize_by(title: 'Do you have another dietary choice?',
conference_id: conference.id,
question_type_id: qtype.id)
question.save!
# Enable the question for the conference
TempConferencesQuestions.find_or_create_by!(conference_id: conference.id,
question_id: question.id)
question_id: question.id)
# Create 'Yes' answer
answer_yes = TempAnswer.find_or_create_by!(title: 'Yes')
# Associate answer with the question
qa = TempQanswer.find_or_initialize_by(question_id: question.id,
answer_id: answer_yes.id)
answer_id: answer_yes.id)
qa.save!
# Associate appropriate answer with registration
TempQanswerRegistration.find_or_create_by!(registration_id: registration.id,
qanswer_id: qa.id)
qanswer_id: qa.id)
# Move data from other_dietary_choice to other_special_needs
registration.other_special_needs << "Other dietary choice: #{registration.other_dietary_choice}."
@ -148,7 +148,7 @@ class RemoveDietaryChoicesTable < ActiveRecord::Migration
TempQanswerRegistration.where(qanswer_id: qa.id).each do |qa_registration|
answer = TempAnswer.find(qa.answer_id)
registration = TempRegistration.find(qa_registration.registration_id)
dietary_choice = TempDietaryChoice.find_or_create_by!(title: answer.title,
dietary_choice = TempDietaryChoice.find_or_create_by!(title: answer.title,
conference_id: conference.id)
registration.dietary_choice_id = dietary_choice.id
registration.save!