diff --git a/web/app/assets/javascripts/jam_rest.js b/web/app/assets/javascripts/jam_rest.js
index 7a4cbd546..b3c03627c 100644
--- a/web/app/assets/javascripts/jam_rest.js
+++ b/web/app/assets/javascripts/jam_rest.js
@@ -587,7 +587,7 @@
processData: false
});
}
- if(detail) {
+ if(detail && context.JK.currentUserId == id) {
detail.done(function(user) {
window.UserActions.loaded(user)
})
diff --git a/web/app/assets/javascripts/react-components/BookLessonFree.js.jsx.coffee b/web/app/assets/javascripts/react-components/BookLessonFree.js.jsx.coffee
index 97793c160..e0ed48dd6 100644
--- a/web/app/assets/javascripts/react-components/BookLessonFree.js.jsx.coffee
+++ b/web/app/assets/javascripts/react-components/BookLessonFree.js.jsx.coffee
@@ -17,6 +17,7 @@ UserStore = context.UserStore
{beforeShow: @beforeShow, afterShow: @afterShow, beforeHide: @beforeHide})
onUserChanged: (userState) ->
+ console.log("userState", userState)
@setState({user: userState?.user})
checkboxChanged: (e) ->
@@ -435,7 +436,7 @@ UserStore = context.UserStore
if @state.user?.remaining_test_drives == 1
testDriveLessons = "1 TestDrive lesson credit"
else
- testDriveLessons = "#{this.state.user?.remaining_test_drives} TestDrive lesson credits"
+ testDriveLessons = "#{this.state.user.remaining_test_drives} TestDrive lesson credits"
actions = `
+
{columnLeft}
{columnRight}
diff --git a/web/app/assets/javascripts/react-components/stores/BroadcastStore.js.coffee b/web/app/assets/javascripts/react-components/stores/BroadcastStore.js.coffee
index 7245e3611..9f3b5cfbf 100644
--- a/web/app/assets/javascripts/react-components/stores/BroadcastStore.js.coffee
+++ b/web/app/assets/javascripts/react-components/stores/BroadcastStore.js.coffee
@@ -15,8 +15,10 @@ BroadcastStore = Reflux.createStore(
logger.debug("loading broadcast notification...")
onLoadCompleted: (response) ->
- logger.debug("broadcast notification sync completed")
- this.trigger(response)
+ if response.id?
+ logger.debug("broadcast notification sync completed")
+ this.trigger(response)
+
onLoadFailed: (jqXHR) ->
if jqXHR.status != 404
diff --git a/web/app/assets/stylesheets/client/jamkazam.css.scss b/web/app/assets/stylesheets/client/jamkazam.css.scss
index 5905958f1..9d2577e84 100644
--- a/web/app/assets/stylesheets/client/jamkazam.css.scss
+++ b/web/app/assets/stylesheets/client/jamkazam.css.scss
@@ -733,4 +733,8 @@ button.stripe-connect {
border: 0;
margin:0 auto;
display:block;
+}
+
+.site-nav {
+ margin-bottom:10px;
}
\ No newline at end of file
diff --git a/web/app/assets/stylesheets/client/react-components/BookLessonFree.css.scss b/web/app/assets/stylesheets/client/react-components/BookLessonFree.css.scss
index d8850f133..20bad39ab 100644
--- a/web/app/assets/stylesheets/client/react-components/BookLessonFree.css.scss
+++ b/web/app/assets/stylesheets/client/react-components/BookLessonFree.css.scss
@@ -2,4 +2,12 @@
div[data-react-class="BookLesson"] {
height:100%;
+
+
+ .content-body-scroller {
+ height:100%;
+ padding:30px;
+ @include border_box_sizing;
+ }
+
}
diff --git a/web/app/assets/stylesheets/client/react-components/LessonBooking.css.scss b/web/app/assets/stylesheets/client/react-components/LessonBooking.css.scss
index 90c6f1bee..6e5b1ddcb 100644
--- a/web/app/assets/stylesheets/client/react-components/LessonBooking.css.scss
+++ b/web/app/assets/stylesheets/client/react-components/LessonBooking.css.scss
@@ -3,14 +3,6 @@
.lesson-booking {
height:100%;
- padding:30px;
-
- .content-body-scroller {
- height:100%;
- padding:30px;
- @include border_box_sizing;
- }
-
h2 {
font-size: 20px;
diff --git a/web/app/assets/stylesheets/client/react-components/LessonBookingScreen.css.scss b/web/app/assets/stylesheets/client/react-components/LessonBookingScreen.css.scss
index 341a498e9..98d0e2e81 100644
--- a/web/app/assets/stylesheets/client/react-components/LessonBookingScreen.css.scss
+++ b/web/app/assets/stylesheets/client/react-components/LessonBookingScreen.css.scss
@@ -205,11 +205,6 @@
}
}
- .site-nav {
-
- margin-bottom:10px;
- }
-
.iradio_minimal {
display:inline-block;
top: -2px;
diff --git a/web/app/controllers/api_users_controller.rb b/web/app/controllers/api_users_controller.rb
index ae6b4570b..388eb4cae 100644
--- a/web/app/controllers/api_users_controller.rb
+++ b/web/app/controllers/api_users_controller.rb
@@ -935,7 +935,7 @@ ApiUsersController < ApiController
@broadcast.did_view(current_user)
respond_with_model(@broadcast)
else
- render json: { message: 'Not Found'}, status: 404
+ render json: { }, status: 200
end
end
diff --git a/web/spec/features/book_test_drive_spec.rb b/web/spec/features/book_test_drive_spec.rb
index c6c60040f..146d00ca2 100644
--- a/web/spec/features/book_test_drive_spec.rb
+++ b/web/spec/features/book_test_drive_spec.rb
@@ -6,6 +6,7 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
let(:user) { FactoryGirl.create(:user, traditional_band: true,paid_sessions: true, paid_sessions_hourly_rate: 1, paid_sessions_daily_rate:1 ) }
let(:teacher_user) {FactoryGirl.create(:teacher_user, ready_for_session_at: Time.now)}
+ let(:teacher_user2) {FactoryGirl.create(:teacher_user, ready_for_session_at: Time.now)}
before(:each) do
LessonBooking.destroy_all
@@ -72,6 +73,9 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
# the spec says take them back to search; there is some wasted effort here by the student; they have to click the teacher 2x. Ok?
find('.teacher-search-result[data-teacher-id="' + teacher_user.id + '"] .try-test-drive').trigger(:click)
+ find('h2', text: 'book testdrive lesson')
+ find('.booking-info', text: '4 TestDrive lesson credits')
+
# book the lesson
fill_in "slot-1-date", with: "Sun Apr 17 2016"
#find('.slot.slot-1 input.hasDatepicker').trigger(:click)
@@ -92,9 +96,24 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
find('h2', text: 'your lesson has been requested')
+ user.reload
user.student_lesson_bookings.count.should eql 1
lesson_booking = user.student_lesson_bookings.first
lesson_booking.is_requested?.should be_true
+ user.remaining_test_drives.should eql 3
+
+
+ # 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!
+
+
+ find('.teacher-search-result[data-teacher-id="' + teacher_user2.id + '"] .try-test-drive').trigger(:click)
+
+ visit "/client#/teachers/search"
+ find('h2', text: 'book testdrive lesson')
+ find('.booking-info', text: '3 TestDrive lesson credits')
finish_lesson_successfully