VRFS-4110 - Shouldn't offer TestDrive lesson to student who already took one from this teacher

This commit is contained in:
Seth Call 2016-05-23 13:22:26 -05:00
parent e2073b49b9
commit fd85736a32
5 changed files with 206 additions and 79 deletions

View File

@ -17,22 +17,22 @@ LessonTimerActions = context.LessonTimerActions
Reflux.listenTo(LessonTimerStore, "onLessonTimersChanged")
]
lookup : {
name_specified: {name: 'Profile', profile: ''},
experiences_teaching: {name: 'Experience', teacher_profile: "experience"},
experiences_education: {name: 'Experience', teacher_profile: "experience" },
experiences_award: {name: 'Experience', teacher_profile: "experience" },
has_stripe_account: {name: 'Stripe', text: "Press the 'Stripe Connect' button in the bottom-left of the page"},
has_teacher_bio: {name: 'Introduction', teacher_profile: "introduction"},
intro_video: {name: 'Introduction', teacher_profile: "introduction"},
years_teaching: {name: 'Introduction', teacher_profile: "introduction"},
years_playing: {name: 'Introduction', teacher_profile: "introduction"},
instruments_or_subject: {name: 'Basics', teacher_profile: "basics"},
genres: {name: 'Basics', teacher_profile: "basics"},
languages: {name: 'Basics', teacher_profile: "basics"},
teaches_ages_specified: {name: 'Basics', teacher_profile: "basics"},
lookup: {
name_specified: {name: 'Profile', profile: ''},
experiences_teaching: {name: 'Experience', teacher_profile: "experience"},
experiences_education: {name: 'Experience', teacher_profile: "experience"},
experiences_award: {name: 'Experience', teacher_profile: "experience"},
has_stripe_account: {name: 'Stripe', text: "Press the 'Stripe Connect' button in the bottom-left of the page"},
has_teacher_bio: {name: 'Introduction', teacher_profile: "introduction"},
intro_video: {name: 'Introduction', teacher_profile: "introduction"},
years_teaching: {name: 'Introduction', teacher_profile: "introduction"},
years_playing: {name: 'Introduction', teacher_profile: "introduction"},
instruments_or_subject: {name: 'Basics', teacher_profile: "basics"},
genres: {name: 'Basics', teacher_profile: "basics"},
languages: {name: 'Basics', teacher_profile: "basics"},
teaches_ages_specified: {name: 'Basics', teacher_profile: "basics"},
teaching_level_specified: {name: 'Basics', teacher_profile: "basics"},
has_pricing_specified: {name: 'Pricing', teacher_profile: "pricing"}
has_pricing_specified: {name: 'Pricing', teacher_profile: "pricing"}
}
needsFetching: false
@ -79,7 +79,6 @@ LessonTimerActions = context.LessonTimerActions
context.JK.popExternalLinks(@root)
lessonSessionActionSelected: (e, data) ->
lessonId = data.options.id
lesson = @findLesson(lessonId)
@ -90,15 +89,24 @@ LessonTimerActions = context.LessonTimerActions
@app.layout.showDialog('chat-dialog', {d1: 'lesson_' + lessonId})
else if data.lessonAction == 'cancel'
@cancelLesson(lesson)
# @@app.layout.showDialog('cancel-lesson-dialog', {d1: lessonId})
# @@app.layout.showDialog('cancel-lesson-dialog', {d1: lessonId})
else if data.lessonAction == 'join'
SessionActions.enterSession(lesson.music_session.id)
else if data.lessonAction == 'reschedule'
@rescheduleLesson(lesson)
else if data.lessonAction == 'start-5-min'
rest.lessonStartTime({id: lessonId, minutes: 5}).done((response) => (@app.layout.notify({title: 'Start Time Set', text: "Start time for session set to 5 mins from now"})))
rest.lessonStartTime({id: lessonId, minutes: 5}).done((response) => (@app.layout.notify({
title: 'Start Time Set',
text: "Start time for session set to 5 mins from now"
})))
else if data.lessonAction == 'start-35-ago'
rest.lessonStartTime({id: lessonId, minutes: -35}).done((response) => (@app.layout.notify({title: 'Start Time Set', text: "Start time for session set to 35 mins ago"})))
rest.lessonStartTime({
id: lessonId,
minutes: -35
}).done((response) => (@app.layout.notify({
title: 'Start Time Set',
text: "Start time for session set to 35 mins ago"
})))
else if data.lessonAction == 'enter-payment'
window.location.href = "/client#/jamclass/lesson-payment/lesson-booking_#{lessonId}"
else
@ -124,14 +132,18 @@ LessonTimerActions = context.LessonTimerActions
if recurring
if @viewerStudent()
context.JK.Banner.showAlert("Policy Issue", "<p>Were sorry, but you cannot reschedule this recurring lesson right now because it is less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost. You may reschedule this recurring lesson anytime starting from the end of this next scheduled lesson, so please plan to do it then.</p>")
context.JK.Banner.showAlert("Policy Issue",
"<p>Were sorry, but you cannot reschedule this recurring lesson right now because it is less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost. You may reschedule this recurring lesson anytime starting from the end of this next scheduled lesson, so please plan to do it then.</p>")
else
context.JK.Banner.showAlert("Policy Issue", "<p>Were sorry, but you cannot reschedule this recurring lesson right now because it is less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a>. You may reschedule this recurring lesson anytime starting from the end of this next scheduled lesson, so please plan to do it then.</p>")
context.JK.Banner.showAlert("Policy Issue",
"<p>Were sorry, but you cannot reschedule this recurring lesson right now because it is less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a>. You may reschedule this recurring lesson anytime starting from the end of this next scheduled lesson, so please plan to do it then.</p>")
else
if @viewerStudent()
context.JK.Banner.showAlert("Policy Issue", "<p>Were sorry, but you cannot reschedule a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost.</p>")
context.JK.Banner.showAlert("Policy Issue",
"<p>Were sorry, but you cannot reschedule a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost.</p>")
else
context.JK.Banner.showAlert("Policy Issue", "<p>Were sorry, but you cannot reschedule a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a>.</p>")
context.JK.Banner.showAlert("Policy Issue",
"<p>Were sorry, but you cannot reschedule a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a>.</p>")
else
@app.ajaxError(jqXHR)
))
@ -152,12 +164,14 @@ LessonTimerActions = context.LessonTimerActions
request.lesson_session_id = lesson.id
request.update_all = update_all
rest.cancelLessonBooking(request).done((response) => @cancelLessonBookingDone(response, lesson)).fail((response) => @cancelLessonBookingFail(response))
rest.cancelLessonBooking(request).done((response) => @cancelLessonBookingDone(response,
lesson)).fail((response) => @cancelLessonBookingFail(response))
cancelLessonBookingDone: (booking, lesson) ->
if booking.focused_lesson.teacher_short_canceled
if @teacherViewing()
context.JK.Banner.showAlert('late cancellation warning', 'Cancelling a lesson less than 24 hours before its scheduled to start should be avoided, as its an inconvenience to the student. Repeated violations of this policy will negatively affect your teacher score.')
context.JK.Banner.showAlert('late cancellation warning',
'Cancelling a lesson less than 24 hours before its scheduled to start should be avoided, as its an inconvenience to the student. Repeated violations of this policy will negatively affect your teacher score.')
@refreshLesson(lesson.id)
@ -165,7 +179,8 @@ LessonTimerActions = context.LessonTimerActions
@app.ajaxError(jqXHR)
cancelSelected: (lesson, recurring) ->
rest.checkLessonCancel({id: lesson.id, update_all: recurring}).done((response) => (@issueCancelLesson(lesson, recurring))).fail((jqXHR) => (@cancelSelectedFail(jqXHR)))
rest.checkLessonCancel({id: lesson.id, update_all: recurring}).done((response) => (@issueCancelLesson(lesson,
recurring))).fail((jqXHR) => (@cancelSelectedFail(jqXHR)))
cancelSelectedFailed: (jqXHR) ->
if jqXHR.status == 422
@ -174,32 +189,54 @@ LessonTimerActions = context.LessonTimerActions
if @viewerStudent()
buttons = []
buttons.push({name: 'CLOSE', buttonStyle: 'button-grey'})
buttons.push({name: 'CANCEL RECURRING LESSONS', buttonStyle: 'button-orange', click:(() => (@issueCancelLesson(lesson, true)))})
context.JK.Banner.show({title: "Policy Issue", html: "You may cancel this recurring series of lessons, but it is too late to cancel the next scheduled lesson because it is less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost.", buttons: buttons})
buttons.push({
name: 'CANCEL RECURRING LESSONS',
buttonStyle: 'button-orange',
click: (() => (@issueCancelLesson(lesson, true)))
})
context.JK.Banner.show({
title: "Policy Issue",
html: "You may cancel this recurring series of lessons, but it is too late to cancel the next scheduled lesson because it is less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost.",
buttons: buttons
})
else
# path should not be taken
context.JK.Banner.showAlert("Policy Issue", "<p>Were sorry, but you cannot cancel a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost.</p>")
context.JK.Banner.showAlert("Policy Issue",
"<p>Were sorry, but you cannot cancel a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost.</p>")
else
if @viewerStudent()
context.JK.Banner.showAlert("Policy Issue", "<p>Were sorry, but you cannot cancel a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost.</p>")
context.JK.Banner.showAlert("Policy Issue",
"<p>Were sorry, but you cannot cancel a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a> because the instructor cannot reasonably be expected to be able to backfill the time slot that has been lost.</p>")
else
# path should not be taken
context.JK.Banner.showAlert("Policy Issue", "<p>Were sorry, but you cannot cancel a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a>.</p>")
context.JK.Banner.showAlert("Policy Issue",
"<p>Were sorry, but you cannot cancel a lesson less than 24 hours before the lesson start time. This is not allowed in the <a href=\"/corp/terms\" target=\"_blank\">terms of service</a>.</p>")
else
@app.ajaxError(jqXHR)
rescheduleLesson: (lesson) ->
if lesson.recurring
buttons = []
buttons.push({name: 'THIS SESSION', buttonStyle: 'button-orange', click:(() => (@rescheduleSelected(lesson, false)))})
buttons.push({name: 'ALL SESSIONS', buttonStyle: 'button-orange', click:(() => (@rescheduleSelected(lesson, true)))})
context.JK.Banner.show({title: 'Rescheduling Selection', html:'Do you wish to all reschedule all lessons or just the one selected?', buttons: buttons})
buttons.push({
name: 'THIS SESSION',
buttonStyle: 'button-orange',
click: (() => (@rescheduleSelected(lesson, false)))
})
buttons.push({
name: 'ALL SESSIONS',
buttonStyle: 'button-orange',
click: (() => (@rescheduleSelected(lesson, true)))
})
context.JK.Banner.show({
title: 'Rescheduling Selection',
html: 'Do you wish to all reschedule all lessons or just the one selected?',
buttons: buttons
})
else
@rescheduleSelected(lesson, false)
cancelLesson: (lesson) ->
if lesson.isRequested
confirmTitle = 'Confirm Decline'
verbLower = 'decline'
@ -209,11 +246,23 @@ LessonTimerActions = context.LessonTimerActions
if !lesson.isRequested || lesson.recurring
buttons = []
buttons.push({name: 'CANCEL', buttonStyle: 'button-grey'})
buttons.push({name: 'THIS SESSION', buttonStyle: 'button-orange', click:(() => (@cancelSelected(lesson, false)))})
buttons.push({name: 'ALL SESSIONS', buttonStyle: 'button-orange', click:(() => (@cancelSelected(lesson, true)))})
context.JK.Banner.show({title: 'Select One', html:"Do you wish to all #{verbLower} all lessons or just the one selected?", buttons: buttons})
buttons.push({
name: 'THIS SESSION',
buttonStyle: 'button-orange',
click: (() => (@cancelSelected(lesson, false)))
})
buttons.push({name: 'ALL SESSIONS', buttonStyle: 'button-orange', click: (() => (@cancelSelected(lesson, true)))})
context.JK.Banner.show({
title: 'Select One',
html: "Do you wish to all #{verbLower} all lessons or just the one selected?",
buttons: buttons
})
else
context.JK.Banner.showYesNo({title: confirmTitle, html:"Are you sure you want to #{verbLower} this lesson?", yes: () =>(@cancelSelected(lesson, lesson.recurring))})
context.JK.Banner.showYesNo({
title: confirmTitle,
html: "Are you sure you want to #{verbLower} this lesson?",
yes: () => (@cancelSelected(lesson, lesson.recurring))
})
getInitialState: () ->
{
@ -234,7 +283,8 @@ LessonTimerActions = context.LessonTimerActions
checkStripeSuccessReturn: () ->
if $.QueryString['stripe-success']?
if $.QueryString['stripe-success'] == 'true'
context.JK.Banner.showNotice('stripe connected', 'Congratulations, you have successfully connected your Stripe account, so payments for student lessons can now be processed.')
context.JK.Banner.showNotice('stripe connected',
'Congratulations, you have successfully connected your Stripe account, so payments for student lessons can now be processed.')
if window.history.replaceState #ie9 proofing
window.history.replaceState({}, "", "/client#/jamclass")
@ -262,7 +312,6 @@ LessonTimerActions = context.LessonTimerActions
[]
postProcess: (data) ->
for lesson in data.entries
# calculate:
@ -293,7 +342,6 @@ LessonTimerActions = context.LessonTimerActions
updatedLessonSessionReadDone: (lesson_session) ->
# update lesson session data in local state
@updateLessonState(lesson_session)
# if this is a not-confirmed lesson, send them to the view statu screen
@ -314,7 +362,6 @@ LessonTimerActions = context.LessonTimerActions
$this.btOn()
constructMissingLinks: (user) ->
links = []
matches = {}
@ -326,11 +373,13 @@ LessonTimerActions = context.LessonTimerActions
for name, data of matches
if !data.text?
links.push(`<a key={data.name} className="missing-profile" onClick={this.missingProfileClick.bind(this, data)}>{data.name}</a>`)
links.push(`<a key={data.name} className="missing-profile"
onClick={this.missingProfileClick.bind(this, data)}>{data.name}</a>`)
for name, data of matches
if data.text?
links.push(`<a key={data.name} onClick={this.onProfileHelp.bind(this, data)} className="missing-profile">{data.name}</a>`)
links.push(`<a key={data.name} onClick={this.onProfileHelp.bind(this, data)}
className="missing-profile">{data.name}</a>`)
`<ul className="missing-profile-list">{links}</ul>`
else
null
@ -355,7 +404,6 @@ LessonTimerActions = context.LessonTimerActions
e.preventDefault();
SessionActions.enterSession(lesson.music_session.id)
render: () ->
disabled = @state.updating
if !@state.user?.id
@ -376,33 +424,47 @@ LessonTimerActions = context.LessonTimerActions
</div>`
if @state.user?['can_buy_test_drive?']
rightContent = `<div className="jamclass-section">
rightContent = `<div className="jamclass-section student-right-content">
<p className="test-drive-main">
JamClass is the best way to teach or take online music lessons. Learn more about <a href="/landing/jamclass/teachers" rel="external">teaching</a> or <a href="/landing/jamclass/students" rel="external">taking</a> lessons.
JamClass is the best way to teach or take online music lessons.
</p>
<ul>
<li>Connect with the best teacher for you vs. the closest</li>
<li>TestDrive multiple teachers to find your ideal match</li>
<li>Avoid the time and hassle of travel to/from lessons</li>
<li>Enjoy studio quality audio in lessons</li>
<li>Play live in sync with your teacher in lesson sessions</li>
<li>Record lessons to refer back to them any time</li>
</ul>
<p>TestDrive offers 3 unbeatable options for students to try JamClass online lessons, and to find the best teacher:</p>
<ol>
<li>Take 4 full 30-minute lessons from 4 different teachers. Just <span className="price">$49.99</span>. Great for making sure you click with the best teacher for you.</li>
<li>Take 2 full 30-minute lessons from 2 different teachers. Just <span className="price">$29.99</span>. Two lessons for the price of one or try two different teachers.</li>
<li>Take 1 full 30-minute lesson for <span className="price">$9.99</span>. Great value for the online experience if you're sure which teacher you want.</li>
</ol>
<p>TestDrive lets you try:</p>
<ul>
<li>4 teachers for just $12.50 each, or
</li>
<li>2 teachers for just $14.99 each, or
</li>
<li>1 teacher for just $14.99
</li>
</ul>
<div className="actions">
<a href="/client#/jamclass/lesson-payment/test-drive" className="button-orange">SIGN UP FOR TESTDRIVE</a>
</div>
<p>To get started, click the Search Teachers button to the left. When you find a teacher you like, click the Book TestDrive Lesson button, and follow the on-screen instructions to choose the 4-, 2-, or 1-teacher offer.</p>
</div>`
else
rightContent = `<div className="jamclass-section">
<p>Read our <a href="https://jamkazam.desk.com/customer/en/portal/topics/926073-jamclass-online-music-lessons---for-students/articles" rel="external">JamClass user guide for students</a> to learn how to get the most out of your online lessons!
</p>
<p>If you have any problems, please email us at <a href="mailto:support@jamkazam.com">support@jamkazam.com</a>. We're here to help make your lessons a great experience.</p>
</div>`
<p>Read our <a
href="https://jamkazam.desk.com/customer/en/portal/topics/926073-jamclass-online-music-lessons---for-students/articles"
rel="external">JamClass user guide for students</a> to learn how to get the most out of your online lessons!
</p>
<p>If you have any problems, please email us at <a href="mailto:support@jamkazam.com">support@jamkazam.com</a>.
We're here to help make your lessons a great experience.</p>
</div>`
else
searchTeachers = `<div className="search-teachers">
<h2>stripe status</h2>
<div className="field stripe-connect">
<StripeConnect purpose='jamclass-home' user={this.state.user}/>
</div>
@ -417,19 +479,26 @@ LessonTimerActions = context.LessonTimerActions
if pct == 100
pctCompleteMsg = `<p className="pct-complete">Your teacher profile is {pct}% complete.</p>`
else
pctCompleteMsg = `<p className="pct-complete">Your teacher profile is {pct}% complete. The following sections of your profile are missing information. Click any of these links to view and add missing information:</p>`
pctCompleteMsg = `<p className="pct-complete">Your teacher profile is {pct}% complete. The following sections
of your profile are missing information. Click any of these links to view and add missing information:</p>`
missingLinks = @constructMissingLinks(this.state.user)
rightContent = `<div className="jamclass-section">
{pctCompleteMsg}
{missingLinks}
<a className="button-orange view-teacher-profile" onClick={this.viewTeacherProfile}>VIEW TEACHER PROFILE</a>
<p>
Read our <a href="https://jamkazam.desk.com/customer/en/portal/topics/926076-jamclass-online-music-lessons---for-teachers/articles" rel="external">JamClass user guide for teachers</a> to learn how to get the most out of the JamClass technology and marketplace.
Read our <a
href="https://jamkazam.desk.com/customer/en/portal/topics/926076-jamclass-online-music-lessons---for-teachers/articles"
rel="external">JamClass user guide for teachers</a> to learn how to get the most out of the JamClass
technology and marketplace.
</p>
<p>
If you have any problems, please email us <a href="mailto:support@jamkazam.com" rel="external">support@jamkazam.com</a>. We're here to help you build your lesson business.
</p>
If you have any problems, please email us <a href="mailto:support@jamkazam.com" rel="external">support@jamkazam.com</a>.
We're here to help you build your lesson business.
</p>
</div>`
classes = []
@ -441,7 +510,8 @@ LessonTimerActions = context.LessonTimerActions
for lessonData in @lessons()
if lessonData.hasUnreadMessages
unreadMessages = `<a onClick={this.onReadMessage.bind(this, lessonData)}><img src="/assets/content/icon_unread_mail.png"/></a>`
unreadMessages = `<a onClick={this.onReadMessage.bind(this, lessonData)}><img
src="/assets/content/icon_unread_mail.png"/></a>`
else
unreadMessages = null
@ -449,22 +519,32 @@ LessonTimerActions = context.LessonTimerActions
if lessonData.times? && lessonData.displayStatus == 'Scheduled'
if lessonData.times.startingSoon
timeStmt = `<span>Starts in {lessonData.times.until.minutes} minutes. <a onClick={this.joinLessonNow.bind(this, lessonData)}>join lesson now</a></span>`
timeStmt = `<span>Starts in {lessonData.times.until.minutes} minutes. <a
onClick={this.joinLessonNow.bind(this, lessonData)}>join lesson now</a></span>`
else if lessonData.times.initialWindow
minutes = -lessonData.times.until.minutes
if minutes == 1 || minutes == 0
timeStmt = `<span>This lesson just started. <a onClick={this.joinLessonNow.bind(this, lessonData)}>join lesson now</a></span>`
timeStmt = `<span>This lesson just started. <a onClick={this.joinLessonNow.bind(this, lessonData)}>join
lesson now</a></span>`
else
timeStmt = `<span>Started {minutes} minutes ago. <a onClick={this.joinLessonNow.bind(this, lessonData)}>join lesson now</a></span>`
timeStmt = `<span>Started {minutes} minutes ago. <a onClick={this.joinLessonNow.bind(this, lessonData)}>join
lesson now</a></span>`
lesson = `<tr key={lessonData.id} className="lesson-session" data-lesson-session-id={lessonData.id}>
<td className="userColumn"><div className="avatar"><img src={lessonData.other.resolved_photo_url} /></div><a href={lessonData.other.best_profile}><span className="first_name">{lessonData.other.first_name}</span><br/><span className="last_name">{lessonData.other.last_name}</span></a></td>
<td className="userColumn">
<div className="avatar"><img src={lessonData.other.resolved_photo_url}/></div>
<a href={lessonData.other.best_profile}><span
className="first_name">{lessonData.other.first_name}</span><br/><span
className="last_name">{lessonData.other.last_name}</span></a></td>
<td className="startTimeColumn">{timeStmt}</td>
<td className="displayStatusColumn">{lessonData.displayStatus}</td>
<td className="unreadColumn">{unreadMessages}</td>
<td className="actionsColumn"><a data-lesson-id={lessonData.id} className="lesson-session-actions-btn" onClick={this.openMenu.bind(this, lessonData)}>menu <div className="details-arrow arrow-down"/></a></td>
<td className="actionsColumn"><a data-lesson-id={lessonData.id} className="lesson-session-actions-btn"
onClick={this.openMenu.bind(this, lessonData)}>menu
<div className="details-arrow arrow-down"/>
</a></td>
</tr>`
classes.push(lesson)
@ -476,6 +556,7 @@ LessonTimerActions = context.LessonTimerActions
`<div className="content-body-scroller">
<div className="column column-left">
<h2>my lessons</h2>
<div className="my-lessons jamclass-section">
<table className="jamtable">
<thead>
@ -499,7 +580,7 @@ LessonTimerActions = context.LessonTimerActions
{searchTeachers}
</div>
<div className="column column-right">
{rightContent}
{rightContent}
</div>
<br className="clearall"/>
</div>`

View File

@ -138,12 +138,15 @@ proficiencyDescriptionMap = {
showSideBubble: () ->
# :remaining_test_drives, :can_buy_test_drive?
if @user['remaining_test_drives'] > 0
@showUseRemainingTestDrivesBubble()
else if @user['can_buy_test_drive?']
@showBuyTestDriveBubble()
else
if @state.user?['has_booked_test_drive_with_student']
@showBuyNormalLessonBubble()
else
if @user['remaining_test_drives'] > 0
@showUseRemainingTestDrivesBubble()
else if @user['can_buy_test_drive?']
@showBuyTestDriveBubble()
else
@showBuyNormalLessonBubble()
hideSideBubble: () ->
if @screen.btOff

View File

@ -14,11 +14,26 @@
ol {
li {
margin-left:15px;
margin-bottom:20px;
margin-bottom:2px;
list-style:decimal;
color:$ColorTextTypical;
}
}
.student-right-content {
p {
margin-bottom:10px;
}
ul {
margin-bottom:25px;
li {
margin-left:-10px;
margin-bottom:2px;
list-style:disc;
color:$ColorTextTypical;
}
}
}
h2 {
font-size: 20px;
font-weight:700;
@ -46,7 +61,6 @@
color:white;
}
.test-drive-main {
margin-bottom:30px !important;
}
p {
line-height:125% !important;

View File

@ -100,6 +100,9 @@ elsif current_user
node :has_rated_student do |user|
current_user.has_rated_student(user)
end
node :has_booked_test_drive_with_student do |user|
user.has_booked_test_drive_with_student?(current_user)
end
end
child :friends => :friends do

View File

@ -0,0 +1,26 @@
require 'spec_helper'
describe "TeacherProfile", :js => true, :type => :feature, :capybara_feature => true do
subject { page }
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, first_name: "TeacherUser1")}
let(:teacher_user2) {FactoryGirl.create(:teacher_user, ready_for_session_at: Time.now, first_name: "TeacherUser2")}
it "offers test drive bubble" do
teacher_user.touch
fast_signin(user, "/client#/profile/teacher/#{teacher_user.id}")
find('h2', text: 'Book TestDrive Lesson')
end
it "shows book normal if you have had a test drive" do
lesson = testdrive_lesson(user, teacher_user, {finish: true, accept: true})
fast_signin(user, "/client#/profile/teacher/#{teacher_user.id}")
find('h2', text: 'Book Lesson')
end
end