diff --git a/db/manifest b/db/manifest index 6de316f20..0e7ed7388 100755 --- a/db/manifest +++ b/db/manifest @@ -344,4 +344,5 @@ teacher_complete.sql lessons.sql lessons_unread_messages.sql track_school_signups.sql -add_test_drive_types.sql \ No newline at end of file +add_test_drive_types.sql +updated_subjects.sql \ No newline at end of file diff --git a/db/up/updated_subjects.sql b/db/up/updated_subjects.sql new file mode 100644 index 000000000..4bd7873e1 --- /dev/null +++ b/db/up/updated_subjects.sql @@ -0,0 +1,27 @@ +-- https://jamkazam.atlassian.net/browse/VRFS-3407 +UPDATE subjects SET description = 'Composition' WHERE id = 'composing'; +UPDATE subjects SET description = 'Recording & Production' WHERE id = 'recording'; +UPDATE subjects SET description = 'Sight Reading' WHERE id = 'site-reading'; + +INSERT INTO subjects(id, description) VALUES ('film-scoring', 'Film Scoring'); +INSERT INTO subjects(id, description) VALUES ('video-game-scoring', 'Video Game Scoring'); +INSERT INTO subjects(id, description) VALUES ('ear-training', 'Ear Training'); +INSERT INTO subjects(id, description) VALUES ('harmony', 'Harmony'); +INSERT INTO subjects(id, description) VALUES ('music-therapy', 'Music Therapy'); +INSERT INTO subjects(id, description) VALUES ('songwriting', 'Songwriting'); +INSERT INTO subjects(id, description) VALUES ('conducting', 'Conducting'); +INSERT INTO subjects(id, description) VALUES ('instrument-repair', 'Instrument Repair'); +INSERT INTO subjects(id, description) VALUES ('improvisation', 'Improvisation'); +INSERT INTO subjects(id, description) VALUES ('pro-tools', 'Pro Tools'); +INSERT INTO subjects(id, description) VALUES ('ableton-live', 'Ableton Live'); +INSERT INTO subjects(id, description) VALUES ('fl-studio', 'FL Studio'); +INSERT INTO subjects(id, description) VALUES ('garageband', 'GarageBand'); +INSERT INTO subjects(id, description) VALUES ('apple-logic-pro', 'Apple Logic Pro'); +INSERT INTO subjects(id, description) VALUES ('presonus-studio-one', 'PreSonus Studio One'); +INSERT INTO subjects(id, description) VALUES ('reaper', 'Reaper'); +INSERT INTO subjects(id, description) VALUES ('cubase', 'Cubase'); +INSERT INTO subjects(id, description) VALUES ('sonar', 'Sonar'); +INSERT INTO subjects(id, description) VALUES ('reason', 'Reason'); +INSERT INTO subjects(id, description) VALUES ('amplitube', 'AmpliTube'); +INSERT INTO subjects(id, description) VALUES ('line-6-pod', 'Line 6 Pod'); +INSERT INTO subjects(id, description) VALUES ('guitar-ring', 'Guitar Rig'); \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 1b64de4f8..582857e1c 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -210,6 +210,8 @@ module JamRuby before_save :create_remember_token, :if => :should_validate_password? before_save :stringify_avatar_info, :if => :updating_avatar + after_save :after_save + validates :first_name, length: {maximum: 50}, no_profanity: true validates :last_name, length: {maximum: 50}, no_profanity: true validates :biography, length: {maximum: 4000}, no_profanity: true @@ -256,6 +258,16 @@ module JamRuby scope :musicians_geocoded, musicians.geocoded_users scope :email_opt_in, where(:subscribe_email => true) + def after_save + if school_interest && !school_interest_was + AdminMailer.partner({body: "#{email} signed up via the https://www.jamkazam.com/landing/jamclass/schools page.\n\nFull list is here: https://www.jamkazam.com/admin/admin/school_interests", subject: "#{email} is interested in schools"}).deliver + if owned_school.nil? + school = School.new + school.user = self + school.save! + end + end + end def update_teacher_pct if teacher teacher.update_profile_pct @@ -1332,10 +1344,6 @@ module JamRuby UserMailer.welcome_message(user).deliver end - if user.school_interest - AdminMailer.partner({body: "#{user.email} signed up via the https://www.jamkazam.com/landing/jamclass/schools page.\n\nFull list is here: https://www.jamkazam.com/admin/admin/school_interests", subject: "#{user.email} is interested in schools"}).deliver - end - if !user.email_confirmed # any errors here should also rollback the transaction; that's OK. If emails aren't going to be delivered, # it's already a really bad situation; make user signup again diff --git a/web/spec/features/school_landing_spec.rb b/web/spec/features/school_landing_spec.rb index 3aed354d8..7197a3660 100644 --- a/web/spec/features/school_landing_spec.rb +++ b/web/spec/features/school_landing_spec.rb @@ -45,6 +45,7 @@ describe "School Landing", :js => true, :type => :feature, :capybara_feature => user.is_a_student.should be false user.is_a_teacher.should be false user.school_interest.should be true + user.owned_school.should_not be_nil user.musician.should be true end @@ -64,6 +65,7 @@ describe "School Landing", :js => true, :type => :feature, :capybara_feature => user.is_a_teacher.should be false user.school_interest.should be true user.musician.should be true + user.owned_school.should_not be_nil end end