diff --git a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb index 23bdd724c..975e8f9a8 100644 --- a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb +++ b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb @@ -391,6 +391,23 @@ end end + def scheduled_session_daily(receiver, sessions) + sendgrid_category "Notification" + sendgrid_unique_args :type => "scheduled_session_daily" + + sendgrid_recipients([receiver.email]) + sendgrid_substitute('@USERID', [receiver.id]) + + @user = receiver + + mail(:to => receiver.email, + :subject => EmailBatchScheduledSessions.subject, + :title => 'New Scheduled Sessions Matched to You') do |format| + format.text + format.html + end + end + def band_session_join(email, msg, session_id) subject = "A band that you follow has joined a session" unique_args = {:type => "band_session_join"} diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/scheduled_session_daily.html.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/scheduled_session_daily.html.erb new file mode 100644 index 000000000..4a1fc0718 --- /dev/null +++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/scheduled_session_daily.html.erb @@ -0,0 +1,10 @@ +<% provide(:title, 'Scheduled Session RSVP') %> + +
<%= @body %>
+ +
+ <%= @session_name %>
+ <%= @session_date %>
+
Hello <%= @user.first_name %> -- +
+ +The following new sessions that that have been posted during the last 24 hours: +
+Take a look through these new sessions below, and just click the RSVP button on the far right side of the row for any session in which you'd like to play. This will let the session organizer know you're interested, and you'll be notified if the session organizer accepts your request to play in that session! +
+ +HERE WE PRESENT THE SESSIONS IN A TABLE JUST LIKE THE FIND SESSION PAGE + +To see ALL the scheduled sessions that you might be interested in joining, view our Find Session page at: http://www.jamkazam.com/client#/findSession. +
+ +Best Regards,
+ +Team JamKazam diff --git a/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb b/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb index e2b6fc937..4608ed95b 100644 --- a/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb +++ b/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb @@ -80,25 +80,29 @@ WHERE SQL results = ActiveRecord::Base.connection.execute(sql) results.each do |result| - sql = "SELECT session_id, creator_id FROM #{TMP_USER} WHERE user_id = '#{result['user_id']}'" + sql =<