* wip
This commit is contained in:
parent
00dee99e17
commit
8048c5012d
|
|
@ -1,4 +1,4 @@
|
|||
<%= semantic_form_for([:admin, resource], :url => resource.new_record? ? admin_batch_emails_path : "/admin/batch_emails/#{resource.id}") do |f| %>
|
||||
<%= semantic_form_for([:admin, resource], :url => resource.new_record? ? admin_batch_emails_path : "#{Gon.Global.prefix}/admin/batch_emails/#{resource.id}") do |f| %>
|
||||
<%= f.inputs do %>
|
||||
<%= f.input(:from_email, :label => "From Email", :input_html => {:maxlength => 64}) %>
|
||||
<%= f.input(:subject, :label => "Subject", :input_html => {:maxlength => 128}) %>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ module JamRuby
|
|||
# creator_id - music_session.user_id
|
||||
# creator_score_idx - this is the creator's users.last_jam_locidispid
|
||||
# instrument_id - instruments that are open as gleamed from the RSVP. If this is NULL, it means 'ANY INSTRUMENT'
|
||||
# invited_user_id - the ID of a user who was invited. Can be NULL.
|
||||
#
|
||||
# tmp_candidate_recipients
|
||||
# ------------------------
|
||||
|
|
@ -160,12 +161,14 @@ SELECT
|
|||
msess.id AS session_id,
|
||||
msess.user_id AS creator_id,
|
||||
users.last_jam_locidispid AS creator_score_idx,
|
||||
rs.instrument_id
|
||||
rs.instrument_id,
|
||||
invitations.receiver_id AS invited_user_id
|
||||
INTO TEMP TABLE tmp_candidate_sessions
|
||||
FROM music_sessions msess
|
||||
INNER JOIN users ON users.id = msess.user_id
|
||||
INNER JOIN rsvp_slots AS rs ON rs.music_session_id = msess.id
|
||||
LEFT JOIN rsvp_requests_rsvp_slots AS rrrs ON rrrs.rsvp_slot_id = rs.id
|
||||
LEFT JOIN invitations ON invitations.music_session_id = msess.id
|
||||
WHERE
|
||||
open_rsvps = TRUE AND
|
||||
users.last_jam_locidispid IS NOT NULL AND
|
||||
|
|
@ -190,7 +193,8 @@ SELECT
|
|||
INTO TEMP TABLE tmp_candidate_recipients
|
||||
FROM users
|
||||
INNER JOIN musicians_instruments AS mi ON mi.user_id = users.id
|
||||
LEFT JOIN tmp_candidate_sessions ON tmp_candidate_sessions.instrument_id = mi.instrument_id
|
||||
LEFT JOIN tmp_candidate_sessions ON tmp_candidate_sessions.instrument_id = mi.instrument_id OR
|
||||
users.id = tmp_candidate_sessions.invited_user_id
|
||||
WHERE
|
||||
users.last_jam_locidispid IS NOT NULL AND
|
||||
users.musician = TRUE AND
|
||||
|
|
@ -207,10 +211,10 @@ SQL
|
|||
end
|
||||
limit_sql = (self.snapshot? && 0 < ENV[ENV_QUERY_LIMIT].to_i) ? "LIMIT #{ENV[ENV_QUERY_LIMIT]}" : ''
|
||||
sql =<<SQL
|
||||
SELECT
|
||||
SELECT
|
||||
DISTINCT tmp_candidate_recipients.receiver_id,
|
||||
tmp_candidate_sessions.session_id,
|
||||
scores.score AS latency
|
||||
current_scores.full_score AS latency
|
||||
INTO TEMP TABLE tmp_matches
|
||||
FROM current_scores
|
||||
INNER JOIN tmp_candidate_sessions ON tmp_candidate_sessions.creator_score_idx = current_scores.alocidispid
|
||||
|
|
|
|||
|
|
@ -83,6 +83,9 @@ describe EmailBatchScheduledSessions do
|
|||
expect(drummer.instruments.include?(drums)).to eq(true)
|
||||
expect(drummer.instruments.include?(guitar)).to eq(true)
|
||||
obj = scheduled_batch.fetch_recipients
|
||||
obj.each_with_index do |u, i|
|
||||
puts obj[i][0].email
|
||||
end
|
||||
expect(obj.count).to eq(2)
|
||||
|
||||
scheduled_batch.deliver_batch
|
||||
|
|
|
|||
Loading…
Reference in New Issue