diff --git a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb index 42678bda3..63e523204 100644 --- a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb +++ b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb @@ -436,7 +436,7 @@ module JamRuby sendgrid_substitute('@USERID', [user.id]) sendgrid_unique_args :type => "profile_complete_reminder2" - mail(:to => user.email, :subject => "Take 2 minutes to fill out your JamKazam profile now") do |format| + mail(:to => user.email, :subject => I18n.t('user_mailer.profile_complete_reminder2.subject')) do |format| format.text format.html { render layout: "user_mailer_beta" } end @@ -448,7 +448,7 @@ module JamRuby sendgrid_substitute('@USERID', [user.id]) sendgrid_unique_args :type => "profile_complete_reminder3" - mail(:to => user.email, :subject => "Last reminder to update your JamKazam profile") do |format| + mail(:to => user.email, :subject => I18n.t('user_mailer.profile_complete_reminder3.subject')) do |format| format.text format.html { render layout: "user_mailer_beta" } end diff --git a/ruby/lib/jam_ruby/lib/email_profile_reminder.rb b/ruby/lib/jam_ruby/lib/email_profile_reminder.rb index c5de827fc..418e8a7a3 100644 --- a/ruby/lib/jam_ruby/lib/email_profile_reminder.rb +++ b/ruby/lib/jam_ruby/lib/email_profile_reminder.rb @@ -32,15 +32,15 @@ module JamRuby end def self.reminder1_users - EmailProfileReminder.prospect_users.where("users.created_at < ? AND users.profile_complete_reminder1_sent_at IS NULL", 1.day.ago) + EmailProfileReminder.prospect_users.where("users.created_at::date = ? AND users.profile_complete_reminder1_sent_at IS NULL", 1.day.ago.to_date) end def self.reminder2_users - EmailProfileReminder.prospect_users.where("users.created_at < ? AND users.profile_complete_reminder1_sent_at IS NOT NULL AND users.profile_complete_reminder2_sent_at IS NULL", 3.days.ago) + EmailProfileReminder.prospect_users.where("users.created_at::date = ? AND users.profile_complete_reminder1_sent_at IS NOT NULL AND users.profile_complete_reminder2_sent_at IS NULL", 3.days.ago.to_date) end def self.reminder3_users - EmailProfileReminder.prospect_users.where("users.created_at < ? AND users.profile_complete_reminder2_sent_at IS NOT NULL AND users.profile_complete_reminder3_sent_at IS NULL", 5.days.ago) + EmailProfileReminder.prospect_users.where("users.created_at::date = ? AND users.profile_complete_reminder2_sent_at IS NOT NULL AND users.profile_complete_reminder3_sent_at IS NULL", 5.days.ago.to_date) end diff --git a/ruby/lib/jam_ruby/lib/gear_setup_reminder.rb b/ruby/lib/jam_ruby/lib/gear_setup_reminder.rb index bad88850d..ff70db17e 100644 --- a/ruby/lib/jam_ruby/lib/gear_setup_reminder.rb +++ b/ruby/lib/jam_ruby/lib/gear_setup_reminder.rb @@ -28,19 +28,19 @@ module JamRuby end def self.prospect_users - User.where("users.first_certified_gear_at IS NULL") + User.where("users.first_certified_gear_at IS NULL AND users.subscribe_email = ?", true) end def self.reminder1_users(cutoff_date) - GearSetupReminder.prospect_users.where("users.created_at < ? AND users.created_at > ? AND users.gear_setup_reminder1_sent_at IS NULL", 1.day.ago, cutoff_date) + GearSetupReminder.prospect_users.where("users.created_at::date = ? AND users.created_at > ? AND users.gear_setup_reminder1_sent_at IS NULL", 1.day.ago.to_date, cutoff_date) end def self.reminder2_users(cutoff_date) - GearSetupReminder.prospect_users.where("users.created_at < ? AND users.created_at > ? AND users.gear_setup_reminder1_sent_at IS NOT NULL AND users.gear_setup_reminder2_sent_at IS NULL", 3.days.ago, cutoff_date) + GearSetupReminder.prospect_users.where("users.created_at::date = ? AND users.created_at > ? AND users.gear_setup_reminder1_sent_at IS NOT NULL AND users.gear_setup_reminder2_sent_at IS NULL", 3.days.ago.to_date, cutoff_date) end def self.reminder3_users(cutoff_date) - GearSetupReminder.prospect_users.where("users.created_at < ? AND users.created_at > ? AND users.gear_setup_reminder2_sent_at IS NOT NULL AND users.gear_setup_reminder3_sent_at IS NULL", 5.days.ago, cutoff_date) + GearSetupReminder.prospect_users.where("users.created_at::date = ? AND users.created_at > ? AND users.gear_setup_reminder2_sent_at IS NOT NULL AND users.gear_setup_reminder3_sent_at IS NULL", 5.days.ago.to_date, cutoff_date) end end diff --git a/ruby/lib/jam_ruby/lib/group_session_reminder.rb b/ruby/lib/jam_ruby/lib/group_session_reminder.rb index 7d58c4101..12ef1ac9d 100644 --- a/ruby/lib/jam_ruby/lib/group_session_reminder.rb +++ b/ruby/lib/jam_ruby/lib/group_session_reminder.rb @@ -36,11 +36,11 @@ module JamRuby end def self.reminder2_users(cutoff_date) - GroupSessionReminder.prospect_users.where("users.created_at > ? AND users.group_session_reminder1_sent_at IS NOT NULL AND users.group_session_reminder2_sent_at IS NULL AND users.first_music_session_at < ?", cutoff_date, 3.days.ago) + GroupSessionReminder.prospect_users.where("users.created_at > ? AND users.group_session_reminder1_sent_at IS NOT NULL AND users.group_session_reminder2_sent_at IS NULL AND users.first_music_session_at::date = ?", cutoff_date, 3.days.ago.to_date) end def self.reminder3_users(cutoff_date) - GroupSessionReminder.prospect_users.where("users.created_at > ? AND users.group_session_reminder2_sent_at IS NOT NULL AND users.group_session_reminder3_sent_at IS NULL AND users.first_music_session_at < ?", cutoff_date, 5.days.ago) + GroupSessionReminder.prospect_users.where("users.created_at > ? AND users.group_session_reminder2_sent_at IS NOT NULL AND users.group_session_reminder3_sent_at IS NULL AND users.first_music_session_at::date = ?", cutoff_date, 5.days.ago.to_date) end end diff --git a/ruby/lib/jam_ruby/lib/test_gear_reminder.rb b/ruby/lib/jam_ruby/lib/test_gear_reminder.rb index b9f1eb365..09b1737a9 100644 --- a/ruby/lib/jam_ruby/lib/test_gear_reminder.rb +++ b/ruby/lib/jam_ruby/lib/test_gear_reminder.rb @@ -31,15 +31,15 @@ module JamRuby end def self.reminder1_users(cutoff_date) - TestGearReminder.prospect_users.where("users.first_certified_gear_at < ? AND users.created_at >= ? AND users.test_gear_reminder1_sent_at IS NULL", 1.day.ago, cutoff_date) + TestGearReminder.prospect_users.where("users.first_certified_gear_at::date = ? AND users.created_at >= ? AND users.test_gear_reminder1_sent_at IS NULL", 1.day.ago.to_date, cutoff_date) end def self.reminder2_users(cutoff_date) - TestGearReminder.prospect_users.where("users.first_certified_gear_at < ? AND users.created_at >= ? AND users.test_gear_reminder1_sent_at IS NOT NULL AND users.test_gear_reminder2_sent_at IS NULL", 3.days.ago, cutoff_date) + TestGearReminder.prospect_users.where("users.first_certified_gear_at::date = ? AND users.created_at >= ? AND users.test_gear_reminder1_sent_at IS NOT NULL AND users.test_gear_reminder2_sent_at IS NULL", 3.days.ago.to_date, cutoff_date) end def self.reminder3_users(cutoff_date) - TestGearReminder.prospect_users.where("users.first_certified_gear_at < ? AND users.created_at > ? AND users.test_gear_reminder2_sent_at IS NOT NULL AND users.test_gear_reminder3_sent_at IS NULL", 5.days.ago, cutoff_date) + TestGearReminder.prospect_users.where("users.first_certified_gear_at::date = ? AND users.created_at > ? AND users.test_gear_reminder2_sent_at IS NOT NULL AND users.test_gear_reminder3_sent_at IS NULL", 5.days.ago.to_date, cutoff_date) end end end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/lib/trial_expires_reminder.rb b/ruby/lib/jam_ruby/lib/trial_expires_reminder.rb index e4dd9540e..2e9a43df3 100644 --- a/ruby/lib/jam_ruby/lib/trial_expires_reminder.rb +++ b/ruby/lib/jam_ruby/lib/trial_expires_reminder.rb @@ -8,24 +8,24 @@ module JamRuby class TrialExpiresReminder @@log = Logging.logger[TrialExpiresReminder] - FIRST_NOTIFICATION_CHECK = 1.day.ago.to_s - SECOND_NOTIFICATION_CHECK = 5.days.ago.to_s - THIRD_NOTIFICATION_CHECK = 9.days.ago + FIRST_NOTIFICATION_CHECK = 1.day.ago.to_date + SECOND_NOTIFICATION_CHECK = 5.days.ago.to_date + THIRD_NOTIFICATION_CHECK = 9.days.ago.to_date def self.prospect_users(cutoff_date) User.where("(users.subscription_trial_ends_at IS NOT NULL AND users.subscription_trial_ends_at > ?)", cutoff_date) end def self.reminder1_users(cutoff_date) - prospect_users(cutoff_date).where("users.subscription_last_checked_at < ? AND users.subscription_trial_ends_at < ? AND users.trial_expires_reminder1_sent_at IS NULL", 1.day.ago, FIRST_NOTIFICATION_CHECK) + prospect_users(cutoff_date).where("users.subscription_last_checked_at < ? AND users.subscription_trial_ends_at::date = ? AND users.trial_expires_reminder1_sent_at IS NULL", 1.day.ago, FIRST_NOTIFICATION_CHECK) end def self.reminder2_users(cutoff_date) - prospect_users(cutoff_date).where("users.subscription_last_checked_at < ? AND users.subscription_trial_ends_at < ? AND trial_expires_reminder1_sent_at IS NOT NULL AND users.trial_expires_reminder2_sent_at IS NULL", 1.day.ago, SECOND_NOTIFICATION_CHECK) + prospect_users(cutoff_date).where("users.subscription_last_checked_at < ? AND users.subscription_trial_ends_at::date = ? AND trial_expires_reminder1_sent_at IS NOT NULL AND users.trial_expires_reminder2_sent_at IS NULL", 1.day.ago, SECOND_NOTIFICATION_CHECK) end def self.reminder3_users(cutoff_date) - prospect_users(cutoff_date).where("users.subscription_last_checked_at < ? AND users.subscription_trial_ends_at < ? AND trial_expires_reminder2_sent_at IS NOT NULL AND users.trial_expires_reminder3_sent_at IS NULL", 1.day.ago, THIRD_NOTIFICATION_CHECK) + prospect_users(cutoff_date).where("users.subscription_last_checked_at < ? AND users.subscription_trial_ends_at::date = ? AND trial_expires_reminder2_sent_at IS NOT NULL AND users.trial_expires_reminder3_sent_at IS NULL", 1.day.ago, THIRD_NOTIFICATION_CHECK) end def self.send_reminders diff --git a/web/config/locales/en.yml b/web/config/locales/en.yml index c450dc48f..b827d9883 100644 --- a/web/config/locales/en.yml +++ b/web/config/locales/en.yml @@ -84,7 +84,7 @@ en: regards: "Best Regards," signature: "JamKazam Team" profile_complete_reminder2: - subject: "Complete your JamKazam profile" + subject: "Take 2 minutes to fill out your JamKazam profile now" greeting: "Hello" paragraph1: "We share your profile with JamKazam members who may be a good fit to play music with you during your first week on the platform via an automated email feature. Don’t miss this opportunity to connect. Click the button below to update your profile now, before it’s shared with others!" update_profile: "Update Profile" @@ -92,7 +92,7 @@ en: regards: "Best Regards," signature: "JamKazam Team" profile_complete_reminder3: - subject: "Complete your JamKazam profile" + subject: "Last reminder to update your JamKazam profile" greeting: "Hello" paragraph1: "Your profile is your key to connecting with other musicians on JamKazam. It lets others know what instruments you play at what level of proficiency and what kinds of music you like to play. This lets our existing community find and reach out to you to connect and play, and this information also powers our automated matchmaking features that make recommendations to you. If you think you might want to play music live online on JamKazam, please click the button below now to fill out your profile!" update_profile: "Update Profile"