Fix bad test drive count on booking page and add nav
This commit is contained in:
parent
a4a869535e
commit
71df46a6ca
|
|
@ -587,7 +587,7 @@
|
|||
processData: false
|
||||
});
|
||||
}
|
||||
if(detail) {
|
||||
if(detail && context.JK.currentUserId == id) {
|
||||
detail.done(function(user) {
|
||||
window.UserActions.loaded(user)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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 = `<div className="actions left">
|
||||
<a className={cancelClasses} onClick={this.onCancel}>CANCEL</a>
|
||||
|
|
@ -515,6 +516,7 @@ UserStore = context.UserStore
|
|||
</div>`
|
||||
|
||||
`<div className="content-body-scroller">
|
||||
<Nav/>
|
||||
<div className="lesson-booking">
|
||||
{columnLeft}
|
||||
{columnRight}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -733,4 +733,8 @@ button.stripe-connect {
|
|||
border: 0;
|
||||
margin:0 auto;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.site-nav {
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
|
@ -2,4 +2,12 @@
|
|||
|
||||
div[data-react-class="BookLesson"] {
|
||||
height:100%;
|
||||
|
||||
|
||||
.content-body-scroller {
|
||||
height:100%;
|
||||
padding:30px;
|
||||
@include border_box_sizing;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -205,11 +205,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.site-nav {
|
||||
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
.iradio_minimal {
|
||||
display:inline-block;
|
||||
top: -2px;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue