clean up no bill email

This commit is contained in:
Seth Call 2016-05-24 10:45:15 -05:00
parent 4545b9b273
commit 1528de57a4
6 changed files with 35 additions and 8 deletions

View File

@ -952,7 +952,7 @@ module JamRuby
@session_url = lesson_session.web_url
@lesson_session = lesson_session
email = @student.email
email = @teacher.email
subject = "Your TestDrive with #{@teacher.name} was not successful"
unique_args = {:type => "teacher_test_drive_no_bill"}
@ -960,7 +960,7 @@ module JamRuby
sendgrid_unique_args :type => unique_args[:type]
sendgrid_recipients([email])
sendgrid_substitute('@USERID', [@student.id])
sendgrid_substitute('@USERID', [@teacher.id])
mail(:to => email, :subject => subject) do |format|
format.text

View File

@ -6,7 +6,7 @@
Hello <%= @student.name %>,
</p>
<p>You have not used a credit for today's TestDrive with <%= @teacher.name %>.
<p>You have not used a credit for today's TestDrive with <%= @teacher.name %> because <%= @lesson_session.error_display %>.
<br/>
<br/>
Click the button below to see more information about this session.

View File

@ -6,7 +6,7 @@
Hello <%= @teacher.name %>,
</p>
<p>Your TestDrive with <%= @student.name %> was not successful because <@= lesson_session.error_display %>.
<p>Your TestDrive with <%= @student.name %> was not successful because <%= @lesson_session.error_display %>.
<br/>
<br/>
Click the button below to see more information about this session.

View File

@ -266,9 +266,23 @@ module JamRuby
def error_display
if analysed
""
if !success
analysis_json = JSON.parse(self.analysis)
if analysis_json["teacher_analysis"]["missed"] && analysis_json["student_analysis"]["missed"]
"both the student and teacher missed the lesson"
elsif analysis_json["teacher_analysis"]["missed"]
"the teacher missed the lesson"
elsif analysis_json["student_analysis"]["missed"]
"the student missed the lesson"
else
"unknown error reason"
end
else
"because no error"
end
else
"unknown reason"
"not yet analysed"
end
end

View File

@ -98,6 +98,21 @@ describe "RenderMailers", :slow => true do
UserMailer.student_scheduled_jamclass_invitation(lesson_session.student, "custom message", lesson_session.music_session).deliver
end
it "student_test_drive_no_bill" do
@filename = "student_test_drive_no_bill"
lesson = testdrive_lesson(user, teacher, {accept: true, miss: true})
UserMailer.deliveries.clear
UserMailer.student_test_drive_no_bill(lesson).deliver
end
it "teacher_test_drive_no_bill" do
@filename = "teacher_test_drive_no_bill"
lesson = testdrive_lesson(user, teacher, {accept: true, miss: true})
UserMailer.deliveries.clear
UserMailer.teacher_test_drive_no_bill(lesson).deliver
end
it "student_test_drive_lesson_completed" do
@filename = "student_test_drive_lesson_completed"
lesson = testdrive_lesson(user, teacher)

View File

@ -74,8 +74,6 @@ def book_lesson(user, teacher, options)
end
if options[:miss]
# teacher & student get into session
Timecop.travel(end_time + 1)