From 175d6d458e325923e6d8a06c84052899f1ae1a4d Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 15 Oct 2017 17:07:35 -0500 Subject: [PATCH] update email for amazon users --- db/up/amazon_signup.sql | 3 ++- ruby/lib/jam_ruby/app/mailers/user_mailer.rb | 16 ++++++++++++++++ .../amazon_welcome_message.html.erb | 18 ++++++++++++++++++ .../amazon_welcome_message.text.erb | 14 ++++++++++++++ .../lib/jam_ruby/models/lesson_package_type.rb | 4 ++++ ruby/lib/jam_ruby/models/posa_card.rb | 3 +++ ruby/lib/jam_ruby/models/user.rb | 9 ++++++++- web/config/application.rb | 2 +- 8 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.html.erb create mode 100644 ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.text.erb diff --git a/db/up/amazon_signup.sql b/db/up/amazon_signup.sql index 471c7783a..4f973ad4f 100644 --- a/db/up/amazon_signup.sql +++ b/db/up/amazon_signup.sql @@ -1 +1,2 @@ -ALTER TABLE users ADD COLUMN under_13 BOOLEAN; \ No newline at end of file +ALTER TABLE users ADD COLUMN under_13 BOOLEAN; +ALTER TABLE users ADD COLUMN via_amazon BOOLEAN; \ No newline at end of file diff --git a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb index 376b2c0fa..bba31d238 100644 --- a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb +++ b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb @@ -66,6 +66,22 @@ module JamRuby end end + def amazon_welcome_message(user) + @user = user + @subject = "Your 2 free music lessons" + sendgrid_category "Welcome" + sendgrid_unique_args :type => "welcome_message" + + sendgrid_recipients([user.email]) + sendgrid_substitute('@USERID', [user.id]) + sendgrid_substitute(EmailBatchProgression::VAR_FIRST_NAME, [user.first_name]) + + mail(:to => user.email, :subject => @subject) do |format| + format.text + format.html + end + end + def student_welcome_message(user) @user = user @subject = "Welcome to JamKazam and JamClass online lessons!" diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.html.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.html.erb new file mode 100644 index 000000000..352812433 --- /dev/null +++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.html.erb @@ -0,0 +1,18 @@ +

+ Welcome to JamKazam, and congratulations on the purchase of your new guitar or bass from Amazon! +

+ +

+ Connecting with a world-class instructor is the best way to learn to play an instrument. Your instructor will guide you based on your unique goals, make sure you’re doing things correctly to build a solid foundation, and maximize your musical growth from your investment of time. +

+ +

JamKazam has attracted a community of world-class instructors and has built a truly unique technology platform that lets students and instructors learn and play together over the Internet from the comfort and convenience of home.

+

+Within a day or two, one of our support team members will reach out to you via email to help you get ready for your first lesson. We provide free and highly personalized 1:1 support to help you set up our app with audio and video, make sure everything is working properly, and get you comfortable with the features you’ll be using in your lessons. +

+

+Thanks again for joining our community of <%= APP_CONFIG.musician_count %> musicians and starting your musical journey with us! We’ll be in touch very soon. +

+ +

Best Regards,
+ Team JamKazam

\ No newline at end of file diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.text.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.text.erb new file mode 100644 index 000000000..ad965437d --- /dev/null +++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/amazon_welcome_message.text.erb @@ -0,0 +1,14 @@ +<% provide(:title, @subject) %> + +Welcome to JamKazam, and congratulations on the purchase of your new guitar or bass from Amazon! + +Connecting with a world-class instructor is the best way to learn to play an instrument. Your instructor will guide you based on your unique goals, make sure you’re doing things correctly to build a solid foundation, and maximize your musical growth from your investment of time. + +JamKazam has attracted a community of world-class instructors and has built a truly unique technology platform that lets students and instructors learn and play together over the Internet from the comfort and convenience of home.

+ +Within a day or two, one of our support team members will reach out to you via email to help you get ready for your first lesson. We provide free and highly personalized 1:1 support to help you set up our app with audio and video, make sure everything is working properly, and get you comfortable with the features you’ll be using in your lessons. + +Thanks again for joining our community of <%= APP_CONFIG.musician_count %> musicians and starting your musical journey with us! We’ll be in touch very soon. + +Best Regards, +Team JamKazam \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/lesson_package_type.rb b/ruby/lib/jam_ruby/models/lesson_package_type.rb index c41cd3363..ae8198a58 100644 --- a/ruby/lib/jam_ruby/models/lesson_package_type.rb +++ b/ruby/lib/jam_ruby/models/lesson_package_type.rb @@ -48,6 +48,10 @@ module JamRuby LessonPackageType.find(SINGLE_FREE) end + def is_amazon? + AMAZON_PACKAGES.include?(id) + end + def self.amazon_test_drive_free_4 LessonPackageType.find(AMAZON_TEST_DRIVE_FREE_4_ID) end diff --git a/ruby/lib/jam_ruby/models/posa_card.rb b/ruby/lib/jam_ruby/models/posa_card.rb index 8574c9961..da87d00b2 100644 --- a/ruby/lib/jam_ruby/models/posa_card.rb +++ b/ruby/lib/jam_ruby/models/posa_card.rb @@ -38,6 +38,9 @@ module JamRuby validate :must_be_activated validate :within_one_year + def is_amazon_posa_card? + lesson_package_type.is_amazon? + end def is_lesson_posa_card? self.is_lesson end diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 2109eae41..600cfd550 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -1367,6 +1367,7 @@ module JamRuby if posa_card posa_card.claim(user) + user.via_amazon = posa_card.is_amazon_posa_card? user.posa_cards << posa_card user.purchase_required = posa_card.requires_purchase # temporary; just so the signup page knows to send them to payment place else @@ -1467,7 +1468,13 @@ module JamRuby end AdminMailer.jamclass_alerts({subject: "#{user.email} just signed up as a student", body: body}).deliver_now - UserMailer.student_welcome_message(user).deliver_now + if user.via_amazon + UserMailer.amazon_welcome_message(user).deliver_now + else + UserMailer.student_welcome_message(user).deliver_now + end + + #end elsif user.is_a_teacher UserMailer.teacher_welcome_message(user).deliver_now diff --git a/web/config/application.rb b/web/config/application.rb index 90684ff4d..1e65eefc1 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -448,7 +448,7 @@ if defined?(Bundler) config.end_of_wait_window_forgiveness_minutes = 1 config.olark_enabled = true config.jamclass_enabled = false - config.musician_count = '40,000+' + config.musician_count = '75,000+' config.jamblaster_menu = false # Applications created before Rails 4.1 uses Marshal to serialize cookie values into the signed and encrypted cookie jars. # If you want to use the new JSON-based format in your application, you can add an initializer file with the following content: