Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/rsvps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def update
bus_after_rsvp = @questionnaire.bus_list_id
acc_status_after_rsvp = @questionnaire.acc_status

if bus != nil && (acc_status != acc_status_after_rsvp || bus != bus_after_rsvp) && @questionnaire.is_bus_captain == true
if !bus.nil? && (acc_status != acc_status_after_rsvp || bus != bus_after_rsvp) && @questionnaire.is_bus_captain == true
@questionnaire.is_bus_captain = false
directors = User.where(role: :director)
directors.each do |user|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
class MoveUserInfoFromQuestionnaireToUserModel < ActiveRecord::Migration[5.2]

# See the "Hackathon Manager 2.0 Migration Guide"
# for a more general description of what this migration does.

# Effectively, we move the `first_name` and `last_name` columns
# from the questionnares table to the users table (and model, for both).

def up

# Add the first/last name columns to the users table
add_column :users, :first_name, :string
add_column :users, :last_name, :string
Expand All @@ -26,7 +24,7 @@ def up
email_head = u.email.partition('@').first
u.first_name = email_head
u.last_name = email_head
u.save()
u.save
end

# Remove the first/last name columns from the questionnaires table
Expand All @@ -35,7 +33,6 @@ def up
end

def down

# Add the first/last name columns back to the questionnaires table
add_column :questionnaires, :first_name, :string
add_column :questionnaires, :last_name, :string
Expand All @@ -48,7 +45,7 @@ def down
# and set both their first/last name to nil.
User.all.each do |u|
email_head = u.email.partition('@').first
if u.first_name == email_head and u.last_name == email_head
if u.first_name == email_head && u.last_name == email_head
u.first_name = nil
u.last_name = nil
end
Expand Down