Fix bug where 2nd test drive wouldn't work

This commit is contained in:
Seth Call 2016-05-20 15:33:44 -05:00
parent 7a4be8292f
commit f9aec0526d
9 changed files with 24 additions and 10 deletions

View File

@ -5,6 +5,7 @@ module JamRuby
@@log = Logging.logger[LessonPackagePurchase]
delegate :sent_billing_notices, :last_billing_attempt_at, :billing_attempts, :billing_should_retry, :billed, :billed_at, :billing_error_detail, :billing_error_reason, :is_card_declined?, :is_card_expired?, :last_billed_at_date, :sent_billing_notices, to: :lesson_payment_charge
delegate :test_drive_count, to: :lesson_package_type
# who purchased the lesson package?
belongs_to :user, class_name: "JamRuby::User", :foreign_key => "user_id", inverse_of: :lesson_purchases
@ -53,6 +54,7 @@ module JamRuby
end
def name
lesson_package_type.sale_display
end

View File

@ -460,7 +460,7 @@ module JamRuby
lesson_session.status = booking.status
lesson_session.slot = booking.default_slot
lesson_session.assigned_student = booking.student
if booking.is_test_drive?
if booking.is_test_drive? && booking.student.remaining_test_drives > 0
lesson_session.lesson_package_purchase = booking.student.most_recent_test_drive_purchase
end
lesson_session.save

View File

@ -2068,7 +2068,7 @@ module JamRuby
end
def most_recent_test_drive_purchase
lesson_purchases.where('lesson_package_type_id in (?)', [LessonPackageType.test_drive_package_ids]).order('created_at desc').first
lesson_purchases.where('lesson_package_type_id in (?)', LessonPackageType.test_drive_package_ids).order('created_at desc').first
end
def total_test_drives

View File

@ -242,6 +242,7 @@ describe "TestDrive Lesson Flow" do
LessonBooking.engaged_bookings(user, teacher_user, nil).count.should eql 1
teacher_user.has_booked_test_drive_with_student?(user).should be_true
end
# VRFS-4069

View File

@ -76,7 +76,7 @@
logger.debug("LessonBookingDecision: slot-decision made with value: " + value)
@setState({slot_decision: value})
@setState({"slot-decision": value})
@props.onSlotDecision({slot_decision: value})
else if name == 'update-all'
checked = $(e.target).is(':checked')

View File

@ -24,6 +24,7 @@ teacherActions = window.JK.Actions.Teacher
@iCheckIgnore = true
console.log("CHOICE", choice)
if $candidate.attr('type') == 'radio'
if choice?
$found = @root.find(selector + '[value="' + choice + '"]')

View File

@ -17,7 +17,7 @@
var wizard = null;
function handleHelp() {
return "https://jamkazam.desk.com/customer/portal/articles/1599961-first-time-setup---step-3---configure-tracks";
return "https://jamkazam.desk.com/customer/en/portal/articles/2400702-using-the-setup-wizard-%E2%80%93-step-3-%E2%80%93-configure-tracks"
}
function handleNext() {

View File

@ -69,17 +69,16 @@
.wizard-step{ 'layout-wizard-step' => "2", 'dialog-title' => "Configure Tracks", 'dialog-purpose' => "ConfigureTracks" }
.ftuesteps
.clearall
.help-text In this step, you will select, configure, and test your audio gear. Please watch the video for best instructions.
.help-text In this step, you will set up your live performance audio tracks.
.wizard-step-content.no-selection-range
.wizard-step-column
%h2 Instructions
.ftue-box.instructions
Set up one track for each instrument or vocal part you plan to play. For each track:
%ul
%li Drag and drop the input port(s) from your audio interface to each track.
%li Select the instrument for each track.
%li Edit the first audio track using the "update" link to set it up as an instrumental or vocal track as you like.
%li If desired, add other audio or MIDI tracks for other instruments or vocals.
.center
%a.button-orange.watch-video{href:'https://www.youtube.com/watch?v=SjMeMZpKNR4', rel:'external'} WATCH VIDEO
%a.button-orange.watch-video{href:'https://jamkazam.desk.com/customer/en/portal/articles/2400702-using-the-setup-wizard-%E2%80%93-step-3-%E2%80%93-configure-tracks', rel:'external'} INSTRUCTIONS
.wizard-step-column
= react_component 'ConfigureTracks', {}

View File

@ -77,7 +77,7 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
lesson_booking.lesson_sessions.count.should eql 1
lesson_session1 = lesson_booking.lesson_sessions.first
user.most_recent_test_drive_purchase.should_not be_nil
# let's make sure we can ask for another test drive too!
teacher_user2.teacher.ready_for_session_at = Time.now
teacher_user2.teacher.save!
@ -91,6 +91,17 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
find('h2', text: 'book testdrive lesson')
find('.booking-info', text: '3 TestDrive lesson credits')
fill_out_single_lesson
# we tell user they have test drive purchased, and take them to the teacher screen
find('#banner h1', text: 'Lesson Requested')
# dismiss banner
find('a.button-orange', text:'CLOSE').trigger(:click)
user.student_lesson_bookings.count.should eql 2
lesson_booking2 = user.student_lesson_bookings.order(:created_at).last
lesson_booking2.teacher.should eql teacher_user2
lesson_booking2.lesson_sessions[0].lesson_package_purchase.should_not be_nil
# approve by teacher:
teacher_approve(lesson_session1)