diff --git a/db/up/lessons.sql b/db/up/lessons.sql index 443c867e7..f9598527d 100644 --- a/db/up/lessons.sql +++ b/db/up/lessons.sql @@ -1,8 +1,43 @@ + +CREATE TABLE lesson_package_types ( + id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), + name VARCHAR NOT NULL, + description VARCHAR NOT NULL, + package_type VARCHAR(64) NOT NULL, + price NUMERIC(8,2), + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE lesson_package_purchases ( + id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), + lesson_package_type_id VARCHAR(64) REFERENCES lesson_package_types(id) NOT NULL, + user_id VARCHAR(64) REFERENCES users(id) NOT NULL, + teacher_id VARCHAR(64) REFERENCES teachers(id), + price NUMERIC(8,2), + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + CREATE TABLE lesson_sessions ( id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), - music_session_id VARCHAR(64) FOREIGN KEY ON REFERENCES music_sessions(id) NOT NULL, + music_session_id VARCHAR(64) REFERENCES music_sessions(id) NOT NULL, lesson_type VARCHAR(64) NOT NULL, + teacher_id VARCHAR(64) REFERENCES teachers(id) NOT NULL, + lesson_package_purchase_id VARCHAR(64) REFERENCES lesson_package_purchases(id), duration INTEGER NOT NULL, price NUMERIC(8,2) NOT NULL, - -) \ No newline at end of file + teacher_complete BOOLEAN DEFAULT FALSE NOT NULL, + student_complete BOOLEAN DEFAULT FALSE NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +ALTER TABLE notifications ADD COLUMN lesson_session_id VARCHAR(64) REFERENCES lesson_sessions(id); + +ALTER TABLE users ADD COLUMN is_a_student BOOLEAN NOT NULL DEFAULT FALSE; +ALTER TABLE users ADD COLUMN is_a_teacher BOOLEAN NOT NULL DEFAULT FALSE; + +INSERT INTO lesson_package_types (id, name, description, package_type, price) VALUES ('single', 'Single Lesson', 'A single lesson purchased at the teacher''s price.', 'single', 0.00); +INSERT INTO lesson_package_types (id, name, description, package_type, price) VALUES ('single-free', 'Free Lesson', 'A free, single lesson.', 'single-free', 0.00); +INSERT INTO lesson_package_types (id, name, description, package_type, price) VALUES ('test-drive', 'Test Drive', 'Four reduced-price lessons which you can use to find that ideal teacher.', 'test-drive', 49.99); \ No newline at end of file diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index d655cff1e..2c3d9aa3e 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -264,7 +264,9 @@ require "jam_ruby/models/gift_card" require "jam_ruby/models/gift_card_purchase" require "jam_ruby/models/gift_card_type" require "jam_ruby/models/jam_track_session" - +require "jam_ruby/models/lesson_package_type" +require "jam_ruby/models/lesson_package_purchase" +require "jam_ruby/models/lesson_session" include Jampb module JamRuby diff --git a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb index 40d5480f0..84355a1ae 100644 --- a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb +++ b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb @@ -49,6 +49,36 @@ end end + def student_welcome_message(user) + @user = user + 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 => "Welcome to JamKazam") do |format| + format.text + format.html + end + end + + def teacher_welcome_message(user) + @user = user + 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 => "Welcome to JamKazam") do |format| + format.text + format.html + end + end + def password_changed(user) @user = user diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/student_welcome_message.html.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/student_welcome_message.html.erb new file mode 100644 index 000000000..177f38c92 --- /dev/null +++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/student_welcome_message.html.erb @@ -0,0 +1,119 @@ +<% provide(:title, 'Welcome to JamKazam!') %> + + +<% if !@user.anonymous? %> +

Hello <%= EmailBatchProgression::VAR_FIRST_NAME %> -- +

+<% end %> + + +

We're delighted you have decided to join the JamKazam community of musicians, and we hope + + you will enjoy using JamKazam and JamTracks to play more music. Following are some + + resources and some things you can do to get the most out of JamKazam. +

+ + +

Playing With JamTracks
+ + JamTracks are the best way to play along with your favorite songs. Far better and different than + + traditional backing tracks, our JamTracks are complete multi-track professional recordings, with + + fully isolated tracks for each part of the music. And our free app and Internet service are packed + + with features that give you unmatched creative freedom to learn, practice, record, play with + + others, and share your performances. Here are some great JamTracks resources: +

+ + +

Play Live With Others from Different Locations on JamKazam
+ JamKazam’s free app lets musicians play together live and in sync from different locations over + + the Internet. Kind of like Skype on super audio steroids, with ultra low latency and terrific audio + + quality. You can set up online sessions that are public or private, for you alone or for others to + + join. You can find and join others’ sessions, use backing tracks and loops in sessions, make + + audio and video recordings of session performances, and more. Click here for a set of tutorial + + videos that show how to use these features. +

+ +

Teach or Take Online Music Lessons
+ If you teach music lessons and have tried to give lessons using Skype, you’ll know how + + unsatisfactory that experience is. Audio quality is poor, and latency prohibits teacher and + + student playing together at all. JamKazam is a terrific service for teaching and taking online + + music lessons. If you want to use JamKazam for lessons, we’ll be happy to support both you and + + your students in getting set up and ready to go. +

+ +

Complete Your Profile
+ Every member of our community has a profile. It’s a great way to share a little bit about who + + you are as a musician, as well as your musical interests. For example, what instruments do you + + play? What musical genres do you like best? Are you interested in getting into a virtual/online + + or a real-world band? And so on. Filling out your profile will help you connect with others with + + common interests. To do this, go to www.jamkazam.com or launch the JamKazam app. Then + + click on the Profile tile, and click the Edit Profile button. +

+ +

Invite Your Friends
+ Have friends who are musicians? Invite them to join you to play together on JamKazam. To do + + this, go to www.jamkazam.com or launch the JamKazam app. Then move your mouse over the + + user icon in the top right corner of the screen. A menu will be displayed. Click Invite Friends in + + this menu, and you can then use the options to invite your friends using their email addresses, + + or via Facebook, or using your Google contacts. +

+ +

Get Help
+ + If you run into trouble and need help, please reach out to us. We will be glad to do everything + + we can to answer your questions and get you up and running. You can visit our Support Portal + + to find knowledge base articles and post questions that have not already been answered. You + + can email us at support@jamkazam.com. And if you just want to chat, share tips and war + + stories, and hang out with fellow JamKazamers, you can visit our Community Forum. +

+ +

+
+
+ Again, welcome to JamKazam, and we hope you have a great time here! +

+ +

Best Regards,
+ Team JamKazam

\ No newline at end of file diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/student_welcome_message.text.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/student_welcome_message.text.erb new file mode 100644 index 000000000..52dc8ab65 --- /dev/null +++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/student_welcome_message.text.erb @@ -0,0 +1,43 @@ +<% if !@user.anonymous? %>Hello <%= EmailBatchProgression::VAR_FIRST_NAME %> --<% end %> + +We're delighted that you have decided to try the JamKazam service, and we hope that you will enjoy using JamKazam to play music with others. Following are some resources that can help you get oriented and get the most out of JamKazam. + + +Getting Started +--------------- + +There are basically three kinds of setups you can use to play on JamKazam. + +* Built-In Audio on Your Computer - You can use a Windows or Mac computer, and just use the built-in mic and headphone jack to handle your audio. This is cheap and easy, but your audio quality will suffer, and it will also process audio very slowly, creating problems with latency, or lag, in your sessions. Still, you can at least start experimenting with JamKazam in this way. + +* Computer with External Audio Interface - - You can use a Windows or Mac computer with an external audio interface that you already own and use for recording, if you happen to have one already. If you are going to do this, or use the built-in mic/headphones on your computer, please refer to our Minimum System Requirements at https://jamkazam.desk.com/customer/portal/articles/1288274-minimum-system-requirements to make sure your computer will work. These requirements were on the download page for the app, but you may have sped by them. Also, we'd recommend watching our Getting Started Video at https://www.youtube.com/watch?v=DBo--aj_P1w to learn more about your options here. + +* The JamBlaster - JamKazam has designed a new product from the ground up to be the best way to play music online in real time. It's called the JamBlaster. It processes audio faster than any of the thousands of combinations of computers and interfaces in use on JamKazam today, which means you can play with musicians who are farther away from you, and closer sessions will feel/sound tighter. The JamBlaster is both a computer and an audio interface, so it also eliminates the system requirements worries, and it "just works" so you don't have to be an audio and computer genius to get it working. This is a great product - available only through a Kickstarter program running during a 30-day window during parts of February and March 2015. You can watch the JamBlaster Video at https://www.youtube.com/watch?v=gAJAIHMyois to learn more about this amazing new product. + + +JamKazam Features +----------------- + +JamKazam offers a very robust and exciting set of features for playing online and sharing your performances with others. Here are some videos you can watch to easily get up to speed on some of the things you can do with JamKazam: + +* Creating a Session - https://www.youtube.com/watch?v=EZZuGcDUoWk + +* Finding a Session - https://www.youtube.com/watch?v=xWponSJo-GU + +* Playing in a Session - https://www.youtube.com/watch?v=zJ68hA8-fLA + +* Connecting with Other Musicians - https://www.youtube.com/watch?v=4KWklSZZxRc + +* Working with Recordings - https://www.youtube.com/watch?v=Gn-dOqnNLoY + + +Getting Help +------------ + +If you run into trouble and need help, please reach out to us. We will be glad to do everything we can to answer your questions and get you up and running. You can visit our Support Portal at https://jamkazam.desk.com/ to find knowledge base articles and post questions that have not already been answered. You can email us at support@jamkazam.com. And if you just want to chat, share tips and war stories, and hang out with fellow JamKazamers, you can visit our Community Forum at http://forums.jamkazam.com/. + +Again, welcome to JamKazam, and we look forward to seeing – and hearing – you online soon! + +Best Regards, +Team JamKazam + diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/teacher_welcome_message.html.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/teacher_welcome_message.html.erb new file mode 100644 index 000000000..177f38c92 --- /dev/null +++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/teacher_welcome_message.html.erb @@ -0,0 +1,119 @@ +<% provide(:title, 'Welcome to JamKazam!') %> + + +<% if !@user.anonymous? %> +

Hello <%= EmailBatchProgression::VAR_FIRST_NAME %> -- +

+<% end %> + + +

We're delighted you have decided to join the JamKazam community of musicians, and we hope + + you will enjoy using JamKazam and JamTracks to play more music. Following are some + + resources and some things you can do to get the most out of JamKazam. +

+ + +

Playing With JamTracks
+ + JamTracks are the best way to play along with your favorite songs. Far better and different than + + traditional backing tracks, our JamTracks are complete multi-track professional recordings, with + + fully isolated tracks for each part of the music. And our free app and Internet service are packed + + with features that give you unmatched creative freedom to learn, practice, record, play with + + others, and share your performances. Here are some great JamTracks resources: +

+ + +

Play Live With Others from Different Locations on JamKazam
+ JamKazam’s free app lets musicians play together live and in sync from different locations over + + the Internet. Kind of like Skype on super audio steroids, with ultra low latency and terrific audio + + quality. You can set up online sessions that are public or private, for you alone or for others to + + join. You can find and join others’ sessions, use backing tracks and loops in sessions, make + + audio and video recordings of session performances, and more. Click here for a set of tutorial + + videos that show how to use these features. +

+ +

Teach or Take Online Music Lessons
+ If you teach music lessons and have tried to give lessons using Skype, you’ll know how + + unsatisfactory that experience is. Audio quality is poor, and latency prohibits teacher and + + student playing together at all. JamKazam is a terrific service for teaching and taking online + + music lessons. If you want to use JamKazam for lessons, we’ll be happy to support both you and + + your students in getting set up and ready to go. +

+ +

Complete Your Profile
+ Every member of our community has a profile. It’s a great way to share a little bit about who + + you are as a musician, as well as your musical interests. For example, what instruments do you + + play? What musical genres do you like best? Are you interested in getting into a virtual/online + + or a real-world band? And so on. Filling out your profile will help you connect with others with + + common interests. To do this, go to www.jamkazam.com or launch the JamKazam app. Then + + click on the Profile tile, and click the Edit Profile button. +

+ +

Invite Your Friends
+ Have friends who are musicians? Invite them to join you to play together on JamKazam. To do + + this, go to www.jamkazam.com or launch the JamKazam app. Then move your mouse over the + + user icon in the top right corner of the screen. A menu will be displayed. Click Invite Friends in + + this menu, and you can then use the options to invite your friends using their email addresses, + + or via Facebook, or using your Google contacts. +

+ +

Get Help
+ + If you run into trouble and need help, please reach out to us. We will be glad to do everything + + we can to answer your questions and get you up and running. You can visit our Support Portal + + to find knowledge base articles and post questions that have not already been answered. You + + can email us at support@jamkazam.com. And if you just want to chat, share tips and war + + stories, and hang out with fellow JamKazamers, you can visit our Community Forum. +

+ +

+
+
+ Again, welcome to JamKazam, and we hope you have a great time here! +

+ +

Best Regards,
+ Team JamKazam

\ No newline at end of file diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/teacher_welcome_message.text.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/teacher_welcome_message.text.erb new file mode 100644 index 000000000..52dc8ab65 --- /dev/null +++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/teacher_welcome_message.text.erb @@ -0,0 +1,43 @@ +<% if !@user.anonymous? %>Hello <%= EmailBatchProgression::VAR_FIRST_NAME %> --<% end %> + +We're delighted that you have decided to try the JamKazam service, and we hope that you will enjoy using JamKazam to play music with others. Following are some resources that can help you get oriented and get the most out of JamKazam. + + +Getting Started +--------------- + +There are basically three kinds of setups you can use to play on JamKazam. + +* Built-In Audio on Your Computer - You can use a Windows or Mac computer, and just use the built-in mic and headphone jack to handle your audio. This is cheap and easy, but your audio quality will suffer, and it will also process audio very slowly, creating problems with latency, or lag, in your sessions. Still, you can at least start experimenting with JamKazam in this way. + +* Computer with External Audio Interface - - You can use a Windows or Mac computer with an external audio interface that you already own and use for recording, if you happen to have one already. If you are going to do this, or use the built-in mic/headphones on your computer, please refer to our Minimum System Requirements at https://jamkazam.desk.com/customer/portal/articles/1288274-minimum-system-requirements to make sure your computer will work. These requirements were on the download page for the app, but you may have sped by them. Also, we'd recommend watching our Getting Started Video at https://www.youtube.com/watch?v=DBo--aj_P1w to learn more about your options here. + +* The JamBlaster - JamKazam has designed a new product from the ground up to be the best way to play music online in real time. It's called the JamBlaster. It processes audio faster than any of the thousands of combinations of computers and interfaces in use on JamKazam today, which means you can play with musicians who are farther away from you, and closer sessions will feel/sound tighter. The JamBlaster is both a computer and an audio interface, so it also eliminates the system requirements worries, and it "just works" so you don't have to be an audio and computer genius to get it working. This is a great product - available only through a Kickstarter program running during a 30-day window during parts of February and March 2015. You can watch the JamBlaster Video at https://www.youtube.com/watch?v=gAJAIHMyois to learn more about this amazing new product. + + +JamKazam Features +----------------- + +JamKazam offers a very robust and exciting set of features for playing online and sharing your performances with others. Here are some videos you can watch to easily get up to speed on some of the things you can do with JamKazam: + +* Creating a Session - https://www.youtube.com/watch?v=EZZuGcDUoWk + +* Finding a Session - https://www.youtube.com/watch?v=xWponSJo-GU + +* Playing in a Session - https://www.youtube.com/watch?v=zJ68hA8-fLA + +* Connecting with Other Musicians - https://www.youtube.com/watch?v=4KWklSZZxRc + +* Working with Recordings - https://www.youtube.com/watch?v=Gn-dOqnNLoY + + +Getting Help +------------ + +If you run into trouble and need help, please reach out to us. We will be glad to do everything we can to answer your questions and get you up and running. You can visit our Support Portal at https://jamkazam.desk.com/ to find knowledge base articles and post questions that have not already been answered. You can email us at support@jamkazam.com. And if you just want to chat, share tips and war stories, and hang out with fellow JamKazamers, you can visit our Community Forum at http://forums.jamkazam.com/. + +Again, welcome to JamKazam, and we look forward to seeing – and hearing – you online soon! + +Best Regards, +Team JamKazam + diff --git a/ruby/lib/jam_ruby/models/lesson_package_purchase.rb b/ruby/lib/jam_ruby/models/lesson_package_purchase.rb new file mode 100644 index 000000000..d255a0398 --- /dev/null +++ b/ruby/lib/jam_ruby/models/lesson_package_purchase.rb @@ -0,0 +1,24 @@ +# represents the purchase of a LessonPackage +module JamRuby + class LessonPackagePurchase < ActiveRecord::Base + + @@log = Logging.logger[LessonPackagePurchase] + + def name + lesson_package_type.sale_display + end + + # who purchased the lesson package? + belongs_to :user, class_name: "JamRuby::User" + belongs_to :lesson_package_type, class_name: "JamRuby::LessonPackageType" + belongs_to :teacher, class_name: "JamRuby::Teacher" + + def self.create(user, lesson_package_type) + purchase = LessonPackagePurchase.new + purchase.user = user + purchase.lesson_package_type = lesson_package_type + purchase.save + purchase + end + end +end diff --git a/ruby/lib/jam_ruby/models/lesson_package_type.rb b/ruby/lib/jam_ruby/models/lesson_package_type.rb new file mode 100644 index 000000000..c21cea6f1 --- /dev/null +++ b/ruby/lib/jam_ruby/models/lesson_package_type.rb @@ -0,0 +1,62 @@ +# represenst the type of lesson package +module JamRuby + class LessonPackageType < ActiveRecord::Base + + @@log = Logging.logger[LessonPackageType] + + PRODUCT_TYPE = 'LessonPackageType' + + SINGLE_FREE = 'single-free' + TEST_DRIVE = 'test-drive' + SINGLE = 'single' + + LESSON_PACKAGE_TYPES = + [ + SINGLE_FREE, + TEST_DRIVE, + SINGLE + ] + + validates :name, presence: true + validates :description, presence: true + validates :price, presence: true + validates :package_type, presence: true, inclusion: {in: LESSON_PACKAGE_TYPES} + + def self.single_free + LessonPackageType.find(SINGLE_FREE) + end + + def self.test_drive + LessonPackageType.find(TEST_DRIVE) + end + + def self.single + LessonPackageType.find(SINGLE) + end + + + def sale_display + name + end + + def plan_code + if package_type == SINGLE_FREE + "lesson-package-single-free" + elsif package_type == TEST_DRIVE + "lesson-package-test-drive" + elsif package_type == SINGLE + "lesson-package-single" + else + raise "unknown lesson package type #{package_type}" + end + end + + def sales_region + 'Worldwide' + end + + def to_s + sale_display + end + end +end diff --git a/ruby/lib/jam_ruby/models/lesson_session.rb b/ruby/lib/jam_ruby/models/lesson_session.rb new file mode 100644 index 000000000..b149cc2dd --- /dev/null +++ b/ruby/lib/jam_ruby/models/lesson_session.rb @@ -0,0 +1,23 @@ +# represenst the type of lesson package +module JamRuby + class LessonSession < ActiveRecord::Base + + @@log = Logging.logger[LessonSession] + + LESSON_TYPE_SINGLE = 'single' + LESSON_TYPE_SINGLE_FREE = 'single-free' + LESSON_TYPE_TEST_DRIVE = 'test-drive' + LESSON_TYPES = [LESSON_TYPE_SINGLE, LESSON_TYPE_SINGLE_FREE, LESSON_TYPE_TEST_DRIVE] + + belongs_to :music_session, class_name: "JamRuby::MusicSession" + belongs_to :teacher, class_name: "JamRuby::Teacher" + belongs_to :lesson_package_purchase, class_name: "JamRuby::LessonPackagePurchase" + + validates :duration, presence: true, numericality: {only_integer: true} + validates :lesson_type, inclusion: {in: LESSON_TYPES} + validates :price, presence: true + validates :teacher_complete, inclusion: {in: [true, false]} + validates :student_complete, inclusion: {in: [true, false]} + + end +end diff --git a/ruby/lib/jam_ruby/models/teacher.rb b/ruby/lib/jam_ruby/models/teacher.rb index 690c6cce2..587fcdaed 100644 --- a/ruby/lib/jam_ruby/models/teacher.rb +++ b/ruby/lib/jam_ruby/models/teacher.rb @@ -13,6 +13,8 @@ module JamRuby has_many :experiences_education, :class_name => "JamRuby::TeacherExperience", conditions: {experience_type: 'education'} has_many :experiences_award, :class_name => "JamRuby::TeacherExperience", conditions: {experience_type: 'award'} has_many :reviews, :class_name => "JamRuby::Review", as: :target + has_many :lesson_sessions, :class_name => "JamRuby::LessonSession" + has_many :lesson_package_purchases, :class_name => "JamRuby::LessonPackagePurchase" has_one :review_summary, :class_name => "JamRuby::ReviewSummary", as: :target has_one :user, :class_name => 'JamRuby::User' diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index b8e99e6cd..b2421b0dd 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -208,6 +208,8 @@ module JamRuby validates :terms_of_service, :acceptance => {:accept => true, :on => :create, :allow_nil => false} validates :reuse_card, :inclusion => {:in => [true, false]} + validates :is_a_student, :inclusion => {:in => [true, false]} + validates :is_a_teacher, :inclusion => {:in => [true, false]} validates :has_redeemable_jamtrack, :inclusion => {:in => [true, false]} validates :gifted_jamtracks, presence: true, :numericality => {:less_than_or_equal_to => 100} validates :subscribe_email, :inclusion => {:in => [nil, true, false]} @@ -1063,20 +1065,26 @@ module JamRuby signup_hint = options[:signup_hint] affiliate_partner = options[:affiliate_partner] gift_card = options[:gift_card] + student = options[:student] + teacher = options[:teacher] user = User.new UserManager.active_record_transaction do |user_manager| - user.first_name = first_name - user.last_name = last_name + user.first_name = first_name if first_name.present? + user.last_name = last_name if last_name.present? user.email = email user.subscribe_email = true user.terms_of_service = terms_of_service - user.musician = musician user.reuse_card unless reuse_card.nil? user.gifted_jamtracks = 0 user.has_redeemable_jamtrack = true - + user.is_a_student = !!student + user.is_a_teacher = !!teacher + if user.is_a_student || user.is_a_teacher + musician = true + end + user.musician = !!musician # FIXME: Setting random password for social network logins. This # is because we have validations all over the place on this. @@ -1255,10 +1263,21 @@ module JamRuby user.save end if affiliate_referral_id.present? - # don't send an signup email if email is already confirmed - if user.email_confirmed + + + if user.is_a_student + UserMailer.student_welcome_message(user).deliver + end + + if user.is_a_teacher + UserMailer.teacher_welcome_message(user).deliver + end + + if !user.is_a_teacher && !user.is_a_student UserMailer.welcome_message(user).deliver - else + 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 UserMailer.confirm_email(user, signup_confirm_url.nil? ? nil : (signup_confirm_url + "/" + user.signup_token)).deliver diff --git a/ruby/spec/jam_ruby/models/lesson_package_purchase_spec.rb b/ruby/spec/jam_ruby/models/lesson_package_purchase_spec.rb new file mode 100644 index 000000000..ab05738d1 --- /dev/null +++ b/ruby/spec/jam_ruby/models/lesson_package_purchase_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe LessonPackagePurchase do + + let(:user) {FactoryGirl.create(:user)} + + it "creates" do + purchase = LessonPackagePurchase.create(user, LessonPackageType.single_free) + purchase.valid?.should be_true + end +end diff --git a/ruby/spec/spec_helper.rb b/ruby/spec/spec_helper.rb index 7a4ab16e6..0f28a82de 100644 --- a/ruby/spec/spec_helper.rb +++ b/ruby/spec/spec_helper.rb @@ -95,13 +95,13 @@ end config.before(:suite) do DatabaseCleaner.strategy = :transaction - DatabaseCleaner.clean_with(:deletion, {pre_count: true, reset_ids:false, :except => %w[gift_card_types instruments languages subjects genres icecast_server_groups jamcompany jamisp geoipblocks geoipisp geoiplocations cities regions countries generic_state spatial_ref_sys] }) + DatabaseCleaner.clean_with(:deletion, {pre_count: true, reset_ids:false, :except => %w[gift_card_types lesson_package_types instruments languages subjects genres icecast_server_groups jamcompany jamisp geoipblocks geoipisp geoiplocations cities regions countries generic_state spatial_ref_sys] }) end config.around(:each) do |example| # set no_transaction: true as metadata on your test to use deletion strategy instead if example.metadata[:no_transaction] - DatabaseCleaner.strategy = :deletion, {pre_count: true, reset_ids:false, :except => %w[gift_card_types instruments languages subjects genres icecast_server_groups jamcompany jamisp geoipblocks geoipisp geoiplocations cities regions countries generic_state spatial_ref_sys] } + DatabaseCleaner.strategy = :deletion, {pre_count: true, reset_ids:false, :except => %w[gift_card_types lesson_package_types instruments languages subjects genres icecast_server_groups jamcompany jamisp geoipblocks geoipisp geoiplocations cities regions countries generic_state spatial_ref_sys] } else DatabaseCleaner.strategy = :transaction end diff --git a/web/app/assets/javascripts/react-components/landing/JamClassAffiliateLandingBottomPage.js.jsx.coffee b/web/app/assets/javascripts/react-components/landing/JamClassAffiliateLandingBottomPage.js.jsx.coffee new file mode 100644 index 000000000..204353571 --- /dev/null +++ b/web/app/assets/javascripts/react-components/landing/JamClassAffiliateLandingBottomPage.js.jsx.coffee @@ -0,0 +1,394 @@ +context = window +rest = context.JK.Rest() + +@JamClassAffiliateLandingBottomPage = React.createClass({ + + render: () -> + `
+
+

What Is The JamKazam Affiliate Program?

+ +

If you’re a music store and you sell products like instruments and accessories to musicians, + + JamKazam can add value to every sale you make to customers by enabling you to bundle high-value digital music products and services that are highly complementary to the products you + + are selling – at no additional cost to your customers. For example, you can bundle full + + multitrack recordings from our catalog of 4,000+ popular songs that let your customers play + + along with their favorite songs in incredibly innovative and fun ways, and you can + bundle free + + online music lessons that really work (unlike Skype, which is great for voice chat but horrible for + + music lessons) to help your customers connect with great teachers and stay better engaged + + with their instruments, so they’ll keep coming back for more music products from your store. + + Additionally, when your customers love these digital products and services and choose to buy + + more, we pay you a share of all revenues we earn from these sales, boosting your revenue and + + profit per sale, while simultaneously delivering greater value to your customer.

+ +

If you’re a music school, JamKazam represents a platform far superior to Skype that you can use + + freely to teach your existing students online, both in your area and across the country to reach + + new markets and students. Skype’s audio quality for music is very poor. Its latency is so high + + that teacher and student cannot play together, and it suffers from a number of other critical + + limitations for music lessons, as it was built for voice chat – not music. In addition to delivering + + online music lessons that really work, JamKazam can drive more students to your school + and + + your teachers from our online lesson marketplace, helping you build your business faster and + + bigger.

+ +

And if you’re both a music store and school, we can help you win in all these ways together. If + + this sounds interesting, read on to learn more about some of the unique things we’ve done and + + how they can help to grow your business.

+ +
+

JamTracks Kudos

+
+ + + +

Andy Crowley of AndyGuitar

+
+
+ + + +

Ryan Jones of PianoKeyz

+
+
+ + + +

Carl Brown of GuitarLessions365

+
+
+
+ +
+

JamTracks – The Best Way To Play With Your Favorite Songs

+ +

+ JamTracks are full multitrack recordings of 4,000+ popular songs that deliver amazing fun and + + flexibility for musicians to play with their favorite artists and tunes. With JamTracks, you can: +

+ +

+ JamTracks sell for $1.99 each. Musicians love to play with these, and typically buy a few at a + + time. Imagine that you are selling a set of guitar strings to an electric guitar player. As a + + JamKazam affiliate, you can bundle free JamTracks with the strings sale, delighting your + + customer with the added value. And then when he/she buys more JamTracks, we pay you a + + share of that revenue, adding to your revenues, and improving your margin on your sales. This + + can be applied to just about anything you sell, as we have JamTracks with parts for almost every + + instrument, as well as vocals. And it’s easy to bundle, as you don’t have to specify particular + + songs per product that you sell. You can just give your customer a free JamTracks credit with + + each sale, and your customer can then redeem this credit online to choose their favorite songs. +

+ +

+ Here is a video that shows more about how JamTracks work. +

+
+