VRFS-736 client_notdl mailer

This commit is contained in:
Jonathan Kolyer 2014-05-19 15:12:59 +00:00
parent 4ddd699302
commit e44ccc7653
8 changed files with 59 additions and 27 deletions

View File

@ -10,3 +10,6 @@ ALTER TABLE email_batch_sets ADD COLUMN user_id VARCHAR(64);
CREATE INDEX email_batch_sets_progress_idx ON email_batch_sets(user_id, sub_type);
CREATE INDEX users_musician_email_idx ON users(subscribe_email, musician);
UPDATE users set first_social_promoted_at = first_liked_us;
ALTER TABLE users DROP column first_liked_us;

View File

@ -145,6 +145,7 @@ require "jam_ruby/models/email_batch_set"
require "jam_ruby/models/email_error"
require "jam_ruby/app/mailers/async_mailer"
require "jam_ruby/app/mailers/batch_mailer"
require "jam_ruby/app/mailers/progress_mailer"
require "jam_ruby/models/affiliate_partner"
require "jam_ruby/models/chat_message"

View File

@ -7,16 +7,19 @@ module JamRuby
sendgrid_unique_args :env => Environment.mode
default :from => UserMailer::DEFAULT_SENDER
def progress_reminder(batch_set)
sendgrid_recipients([user.email])
sendgrid_substitute('@USERID', [user.id])
mail(:to => batch_set.user.email,
:subject => batch_set.subject,
:title => batch_set.title,
:template_name => batch_set.sub_type) do |format|
format.text
format.html
end
def send_reminder(batch_set)
user = batch_set.user
sendgrid_recipients([user.email])
sendgrid_substitute('@USERID', [user.id])
sendgrid_substitute(EmailBatchProgression::VAR_FIRST_NAME, [user.first_name])
mail(:to => user.email,
:subject => batch_set.subject,
:title => batch_set.title) do |format|
format.text { render batch_set.sub_type }
format.html { render batch_set.sub_type }
end
end
end

View File

@ -0,0 +1,18 @@
<% provide(:title, @title) %>
<p>Hello <%= EmailBatchProgression::VAR_FIRST_NAME %> --
</p>
<p>We noticed that you have registered as a JamKazam musician, but you have not yet downloaded and started using the free JamKazam application. You can find other musicians and listen to sessions and recordings on our website, but you need the free JamKazam application to play with other musicians online. Please click the link below to go to the download page for the free JamKazam application, or visit our JamKazam support center so that we can help you get up and running.
</p>
<p>
<a style="color: #588C98;" href="http://www.jamkazam.com/downloads">Go to Download Page</a>
</p>
<p>
<a style="color: #588C98;" href="https://jamkazam.desk.com">Go to Support Center</a>
</p>
<p>-- Team JamKazam
</p>

View File

@ -0,0 +1,11 @@
<% provide(:title, @title) %>
Hello <%= EmailBatchProgression::VAR_FIRST_NAME %> --
We noticed that you have registered as a JamKazam musician, but you have not yet downloaded and started using the free JamKazam application. You can find other musicians and listen to sessions and recordings on our website, but you need the free JamKazam application to play with other musicians online. Please click the link below to go to the download page for the free JamKazam application, or visit our JamKazam support center so that we can help you get up and running.
Go to Download Page: http://www.jamkazam.com/downloads
Go to Support Center: https://jamkazam.desk.com
-- Team JamKazam

View File

@ -81,25 +81,21 @@ module JamRuby
def trigger_date_constraint(trigger_idx)
intervals = self.class.subtype_trigger_interval(self.sub_type)
date_constraint = Time.now - intervals[trigger_idx].days
case self.sub_type.to_sym
when :client_notdl
return ["users.created_at < ?", Time.now - intervals[trigger_idx].days]
when :client_notdl, :reg_notconnect, :reg_notinvite, :reg_notlike
return ["users.created_at < ?", date_constraint]
when :client_dl_notrun
return ["users.first_downloaded_client_at < ?", Time.now - intervals[trigger_idx].days]
return ["users.first_downloaded_client_at < ?", date_constraint]
when :client_run_notgear
return ["users.first_ran_client_at < ?", Time.now - intervals[trigger_idx].days]
return ["users.first_ran_client_at < ?", date_constraint]
when :gear_notsess
return ["users.first_certified_gear_at < ?", Time.now - intervals[trigger_idx].days]
return ["users.first_certified_gear_at < ?", date_constraint]
when :sess_notgood
return ["users.first_real_music_session_at < ?", Time.now - intervals[trigger_idx].days]
return ["users.first_real_music_session_at < ?", date_constraint]
when :sess_notrecord
return ["users.first_real_music_session_at < ?", Time.now - intervals[trigger_idx].days]
when :reg_notconnect
return ["users.created_at < ?", Time.now - intervals[trigger_idx].days]
when :reg_notinvite
return ["users.created_at < ?", Time.now - intervals[trigger_idx].days]
when :reg_notlike
return ["users.created_at < ?", Time.now - intervals[trigger_idx].days]
return ["users.first_real_music_session_at < ?", date_constraint]
end
end

View File

@ -29,14 +29,14 @@ module JamRuby
def subject
unless sub_type.blank?
return EmailBatchProgression.subject(self.sub_type)
return EmailBatchProgression.subject(self.sub_type.to_sym)
end
''
end
def title
unless sub_type.blank?
return EmailBatchProgression.title(self.sub_type)
return EmailBatchProgression.title(self.sub_type.to_sym)
end
''
end

View File

@ -371,8 +371,8 @@ class UsersController < ApplicationController
def endorse
if uu = current_user ||
uu = User.where(['id = ? AND first_liked_us IS NULL',params[:id]]).limit(1).first
uu.first_liked_us = Time.now
uu = User.where(['id = ? AND first_social_promoted_at IS NULL',params[:id]]).limit(1).first
uu.first_social_promoted_at = Time.now
uu.save!
end if params[:id].present? && (service=params[:service]).present?