make a school if user shows school interest
This commit is contained in:
parent
4f35d5ce0f
commit
ef153ad4b7
|
|
@ -345,3 +345,4 @@ lessons.sql
|
|||
lessons_unread_messages.sql
|
||||
track_school_signups.sql
|
||||
add_test_drive_types.sql
|
||||
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');
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue