diff --git a/ruby/lib/jam_ruby/models/connection.rb b/ruby/lib/jam_ruby/models/connection.rb
index 5a5378b91..c65c53621 100644
--- a/ruby/lib/jam_ruby/models/connection.rb
+++ b/ruby/lib/jam_ruby/models/connection.rb
@@ -109,13 +109,13 @@ module JamRuby
if music_session.musician_access
if music_session.approval_required
- unless music_session.creator == user || music_session.invited_musicians.exists?(user)
+ if !(music_session.music_session.creator == user || music_session.creator == user || music_session.invited_musicians.exists?(user))
errors.add(:approval_required, ValidationMessages::INVITE_REQUIRED)
return false
end
end
else
- unless music_session.creator == user || music_session.invited_musicians.exists?(user)
+ if !(music_session.music_session.creator == user || music_session.creator == user || music_session.invited_musicians.exists?(user))
errors.add(:musician_access, ValidationMessages::INVITE_REQUIRED)
return false
end
diff --git a/ruby/spec/jam_ruby/models/lesson_session_spec.rb b/ruby/spec/jam_ruby/models/lesson_session_spec.rb
index be1a8963c..3b8d62815 100644
--- a/ruby/spec/jam_ruby/models/lesson_session_spec.rb
+++ b/ruby/spec/jam_ruby/models/lesson_session_spec.rb
@@ -17,6 +17,22 @@ describe LessonSession do
end
end
+ describe "permissions" do
+ it "student can join session" do
+ lesson = normal_lesson(user, teacher)
+
+ FactoryGirl.create(:active_music_session, music_session: lesson.music_session, creator: teacher)
+
+ connection1 = FactoryGirl.create(:connection, user: user, music_session_id: lesson.music_session.active_music_session.id, as_musician: true)
+ connection2 = FactoryGirl.create(:connection, user: teacher, music_session_id: lesson.music_session.active_music_session.id, as_musician: true)
+
+ connection1.can_join_music_session
+ connection1.errors.any?.should be_false
+
+ connection2.can_join_music_session
+ connection2.errors.any?.should be_false
+ end
+ end
describe "upcoming_sessions_reminder" do
it "succeeds" do
lesson = normal_lesson(user, teacher)
diff --git a/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee b/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee
index fff56dea6..783264122 100644
--- a/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee
+++ b/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee
@@ -285,7 +285,11 @@ LessonTimerActions = context.LessonTimerActions
@updateLessonState(lesson_session)
- @app.layout.showDialog('chat-dialog', {d1: 'lesson_' + lesson_session.id})
+ # if this is a not-confirmed lesson, send them to the view statu screen
+ if lesson_session.isRequested
+ window.location.href = '/client#/jamclass/lesson-booking/' + lesson.id
+ else
+ @app.layout.showDialog('chat-dialog', {d1: 'lesson_' + lesson_session.id})
updatedLessonSessionReadFail: (jqXHR) ->
diff --git a/web/app/assets/javascripts/react-components/LessonPayment.js.jsx.coffee b/web/app/assets/javascripts/react-components/LessonPayment.js.jsx.coffee
index dd535db43..1202c0e3e 100644
--- a/web/app/assets/javascripts/react-components/LessonPayment.js.jsx.coffee
+++ b/web/app/assets/javascripts/react-components/LessonPayment.js.jsx.coffee
@@ -417,9 +417,17 @@ UserStore = context.UserStore
header = `
enter payment info for test drive
`
bookingInfo = ``
- bookingDetail = `You are purchasing the TestDrive package of JamClass by JamKazam. This purchase entitles
- you to take 4 private online music lessons - 1 each from 4 different instructors in the JamClass instructor
- community.
+ if this.state.user.lesson_package_type_id == 'test-drive'
+ explanation = `You are purchasing the TestDrive package of JamClass by JamKazam. This purchase entitles you to take 4 private online music lessons - 1 each from 4 different instructors in the JamClass instructor community. The price of this TestDrive package is $49.99.`
+ else if this.state.user.lesson_package_type_id == 'test-drive-1'
+ explanation =`You are purchasing the TestDrive package of JamClass by JamKazam. This purchase entitles you to take 1 private online music lesson from an instructor in the JamClass instructor community. The price of this TestDrive package is $14.99.`
+ else if this.state.user.lesson_package_type_id == 'test-drive-2'
+ explanation =`You are purchasing the TestDrive package of JamClass by JamKazam. This purchase entitles you to take 2 private online music lessons - 1 each from 2 different instructors in the JamClass instructor community. The price of this TestDrive package is $29.99.`
+ else
+ alert("You do not have a test drive package selected")
+
+
+ bookingDetail = `
{explanation}
jamclass
diff --git a/web/config/environments/test.rb b/web/config/environments/test.rb
index 00e39413b..322399460 100644
--- a/web/config/environments/test.rb
+++ b/web/config/environments/test.rb
@@ -55,10 +55,16 @@ SampleApp::Application.configure do
config.websocket_gateway_port = 6759
config.websocket_gateway_uri = "ws://localhost:#{config.websocket_gateway_port}/websocket"
- config.websocket_gateway_connect_time_stale_client = 4
- config.websocket_gateway_connect_time_expire_client = 6
- config.websocket_gateway_connect_time_stale_browser = 4
- config.websocket_gateway_connect_time_expire_browser = 6
+ #config.websocket_gateway_connect_time_stale_client = 4
+ #config.websocket_gateway_connect_time_expire_client = 6
+ #config.websocket_gateway_connect_time_stale_browser = 4
+ #config.websocket_gateway_connect_time_expire_browser = 6
+
+ config.websocket_gateway_connect_time_stale_client = 80
+ config.websocket_gateway_connect_time_expire_client = 120
+ config.websocket_gateway_connect_time_stale_browser = 80
+ config.websocket_gateway_connect_time_expire_browser = 120
+
# this is totally awful and silly; the reason this exists is so that if you upload an artifact
# through jam-admin, then jam-web can point users at it. I think 99% of devs won't even see or care about this config, and 0% of users
diff --git a/web/spec/features/book_single_lesson_spec.rb b/web/spec/features/book_single_lesson_spec.rb
index 79c33204d..78ac9be05 100644
--- a/web/spec/features/book_single_lesson_spec.rb
+++ b/web/spec/features/book_single_lesson_spec.rb
@@ -35,7 +35,7 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
after(:each) do
Timecop.return
end
- it "succeeds" do
+ it "succeeds normal" do
Timecop.travel(Date.new(2016, 03, 01))
testdrive_lesson(user, teacher_user3)
@@ -43,6 +43,10 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
user.save!
user.reload
+ # the testdrive_lesson helper fakes out a credit card, but we need to stop faking and let the web UI drive us into the payment form
+ user.stored_credit_card = false
+ user.save!
+
sign_in_poltergeist user
visit "/client#/teachers/search"
@@ -69,23 +73,15 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
find('a.book-lesson-btn', text: 'BOOK LESSON').trigger(:click)
- #find('h2', text: 'your lesson has been requested')
-
- #find('h2', text: 'enter payment info for lesson')
-
-
- #fill_in 'card-number', with: '4111111111111111'
- #fill_in 'expiration', with: '11/2016'
- #fill_in 'cvv', with: '111'
- #fill_in 'zip', with: '78759'
-
- #find('.purchase-btn').trigger(:click)
+ fill_out_payment('Your card will not be charged until the day of the 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.reload
+ user.stripe_customer_id.should_not be_nil
user.student_lesson_bookings.count.should eql 2 # this single one, and the test drive created in the before section of the test
lesson_booking = user.student_lesson_bookings.order(:created_at).last
lesson_booking.is_requested?.should be_true
@@ -181,6 +177,8 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
analysis["reason"].should eql LessonSessionAnalyser::SUCCESS
lesson_session1.success.should be_true
lesson_session1.billing_attempts.should eql 1
+ puts lesson_session1.billing_error_reason
+ puts lesson_session1.billing_error_detail
lesson_session1.billed.should eql true
LessonBooking.hourly_check
@@ -221,6 +219,10 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
user.school = school
user.save!
+ # the testdrive_lesson helper fakes out a credit card, but we need to stop faking and let the web UI drive us into the payment form
+ user.stored_credit_card = false
+ user.save!
+
sign_in_poltergeist user
visit "/client#/teachers/search"
@@ -247,23 +249,12 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
find('a.book-lesson-btn', text: 'BOOK LESSON').trigger(:click)
- #find('h2', text: 'your lesson has been requested')
-
- #find('h2', text: 'enter payment info for lesson')
-
-
- #fill_in 'card-number', with: '4111111111111111'
- #fill_in 'expiration', with: '11/2016'
- #fill_in 'cvv', with: '111'
- #fill_in 'zip', with: '78759'
-
- #find('.purchase-btn').trigger(:click)
-
# 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 1 # this single one
lesson_booking = user.student_lesson_bookings.order(:created_at).last
lesson_booking.is_requested?.should be_true
@@ -306,18 +297,18 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
teacher_user2.teacher.save!
visit "/client#/teachers/search"
- find('span.search-summary', text: 'my school teachers only')
+ find('span.search-summary', text: 'From My School Only')
find('a.teacher-search-options').trigger(:click)
find('input.onlyMySchool').trigger(:click) # uncheck
find('a.search-btn').trigger(:click)
find('span.search-summary', text: 'all teachers')
find('.teacher-search-result[data-teacher-id="' + teacher_user2.id + '"] .try-test-drive').trigger(:click)
- select_test_drive(4)
+ select_test_drive(2)
fill_out_single_lesson
- fill_out_payment
+ fill_out_payment('This purchase entitles you to take 2 private online music')
sleep 5
@@ -338,9 +329,14 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
lesson_package_purchase = LessonPackagePurchase.where(user_id: user.id, teacher_id: teacher_user.id).order(:created_at).first
lesson_package_purchase.should be_nil
user.reload
- user.remaining_test_drives.should eql 3
+ user.remaining_test_drives.should eql 1
user.sales.count.should eql 1
+ bookings = LessonBooking.where(teacher_id: lesson_session.teacher.id)
+
+ bookings.each do |b|
+ puts "BOOKING: #{b.inspect}"
+ end
# approve by teacher:
teacher_approve(lesson_session1)
diff --git a/web/spec/features/book_test_drive_spec.rb b/web/spec/features/book_test_drive_spec.rb
index 741f7fe7b..670ce87da 100644
--- a/web/spec/features/book_test_drive_spec.rb
+++ b/web/spec/features/book_test_drive_spec.rb
@@ -45,7 +45,7 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
fill_out_single_lesson
- fill_out_payment
+ fill_out_payment('This purchase entitles you to take 4 private online music')
# we tell user they have test drive purchased, and take them to the teacher screen
find('#banner h1', text: 'Test Drive Purchased')
diff --git a/web/spec/features/jamclass_screen_spec.rb b/web/spec/features/jamclass_screen_spec.rb
index 92f5a33e2..e8ec27036 100644
--- a/web/spec/features/jamclass_screen_spec.rb
+++ b/web/spec/features/jamclass_screen_spec.rb
@@ -36,6 +36,9 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
fast_signin(user, "/client#/jamclass")
find('#jam-class-student-screen td.displayStatusColumn', text: 'Missed (Teacher)')
+ # also check that clicking messages icon shows chat dialog (instead of view status screen) # VRFS-4089
+ find('tr[data-lesson-session-id="' + lesson.id + '"] a.unreadColumn').trigger(:click)
+ find('h1', text: 'respond to lesson request')
end
it "shows Completed" do
@@ -58,12 +61,20 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
find('tr[data-lesson-session-id="' + lesson.id + '"] .lesson-session-actions-btn').trigger(:click)
find('li[data-lesson-option="cancel"] a', visible: false, text: 'Decline Request')
+
sign_out_poltergeist
sleep 4
fast_signin(user, "/client#/jamclass")
+
+ # also check that clicking messages icon shows view status screen (instead of chat dialog) # VRFS-4089
+ find('tr[data-lesson-session-id="' + lesson.id + '"] a.unreadColumn').trigger(:click)
+ find('h2', text: 'respond to lesson request')
+
+
find('#jam-class-student-screen td.displayStatusColumn', text: 'Requested')
+
# open up hover
find('tr[data-lesson-session-id="' + lesson.id + '"] .lesson-session-actions-btn').trigger(:click)
# should work, doesn't
diff --git a/web/spec/support/lessons.rb b/web/spec/support/lessons.rb
index ee06f29a7..210ae5ab2 100644
--- a/web/spec/support/lessons.rb
+++ b/web/spec/support/lessons.rb
@@ -27,7 +27,7 @@ def teacher_approve(lesson_session)
visit "/client#/jamclass/lesson-booking/" + lesson_session.id
find('.schedule.button-orange').trigger(:click)
# dismiss banner
- find('a.button-orange', text:'CLOSE').trigger(:click)
+ #find('a.button-orange', text:'CLOSE').trigger(:click)
find('tr[data-lesson-session-id="' + lesson_session.id + '"] .displayStatusColumn', text: 'Scheduled')
end
@@ -56,13 +56,16 @@ def fill_out_single_lesson
end
-def fill_out_payment
+def fill_out_payment(expected = nil)
fill_in 'card-number', with: '4111111111111111'
fill_in 'expiration', with: '11/2016'
fill_in 'cvv', with: '111'
fill_in 'zip', with: '78759'
+ if expected
+ find('.booking-info', text: expected)
+ end
find('.purchase-btn').trigger(:click)
# it needs to go 'disabled state' to indicate it's updating