diff --git a/admin/app/views/admin/users/_form.html.slim b/admin/app/views/admin/users/_form.html.slim index bb666c081..df29c3115 100644 --- a/admin/app/views/admin/users/_form.html.slim +++ b/admin/app/views/admin/users/_form.html.slim @@ -4,6 +4,7 @@ = f.input :admin = f.input :is_onboarder, label: 'Is Support Consultant' = f.input :subscribe_email, label: 'Subscribed to Emails?' + = f.input :gifted_jamtracks, label: 'JamTrack Credits' = f.input :first_name = f.input :last_name = f.input :city diff --git a/db/manifest b/db/manifest index ece0a3d84..b8a025a75 100755 --- a/db/manifest +++ b/db/manifest @@ -386,4 +386,5 @@ better_lesson_notices.sql teacher_search_control.sql user_timezone.sql onboarder_limit.sql -onboarding_emails.sql \ No newline at end of file +onboarding_emails.sql +limit_counter_reminders.sql \ No newline at end of file diff --git a/db/up/limit_counter_reminders.sql b/db/up/limit_counter_reminders.sql new file mode 100644 index 000000000..08d57e0a8 --- /dev/null +++ b/db/up/limit_counter_reminders.sql @@ -0,0 +1 @@ +ALTER TABLE lesson_sessions ADD COLUMN counter_reminders INTEGER NOT NULL DEFAULT 0; \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/lesson_booking.rb b/ruby/lib/jam_ruby/models/lesson_booking.rb index 758c94710..39e2fdfd1 100644 --- a/ruby/lib/jam_ruby/models/lesson_booking.rb +++ b/ruby/lib/jam_ruby/models/lesson_booking.rb @@ -737,7 +737,12 @@ module JamRuby self.autocanceling = true self.active = false self.status = STATUS_UNCONFIRMED - save + if save + if is_test_drive? + user.jamclass_credits = user.jamclass_credits + 1 + user.save(validate:false) + end + end self end diff --git a/ruby/lib/jam_ruby/models/lesson_session.rb b/ruby/lib/jam_ruby/models/lesson_session.rb index 83a2f116c..fe9a00f4f 100644 --- a/ruby/lib/jam_ruby/models/lesson_session.rb +++ b/ruby/lib/jam_ruby/models/lesson_session.rb @@ -147,7 +147,7 @@ module JamRuby if lesson_session.student_last_proposed? relevant_time = [lesson_session.countered_at, lesson_session.lesson_booking.sent_notices_at].find { |x| !x.nil? } - UserMailer.student_no_comm_other(lesson_session.lesson_booking, relevant_time < Time.now - 3.days).deliver_now + UserMailer.student_no_comm_other(lesson_session.lesson_booking, relevant_time < 3.days.ago).deliver_now UserMailer.teacher_counter_reminder(lesson_session).deliver_now else UserMailer.teacher_no_comm_other(lesson_session.lesson_booking).deliver_now diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 9944ec233..76971c1c4 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -340,7 +340,7 @@ module JamRuby end if updates[:onboarding_status] == ONBOARDING_STATUS_ONBOARDED || updates[:onboarding_status] == ONBOARDING_STATUS_LOST || updates[:onboarding_status] == ONBOARDING_STATUS_ESCALATED - self.send_onboarding_survey = true + updates[:send_onboarding_survey] = true end User.where(id: self.id).update_all(updates) diff --git a/ruby/spec/jam_ruby/models/lesson_session_spec.rb b/ruby/spec/jam_ruby/models/lesson_session_spec.rb index c7d0bbfbf..8ab0a4e6f 100644 --- a/ruby/spec/jam_ruby/models/lesson_session_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_session_spec.rb @@ -9,6 +9,8 @@ describe LessonSession do let(:lesson_booking) { b = LessonBooking.book_normal(user, teacher, [slot1, slot2], "Hey I've heard of you before.", false, LessonBooking::PAYMENT_STYLE_SINGLE, 60); b.card_presumed_ok = true; b.save!; b } let(:lesson_session) { lesson_booking.lesson_sessions[0] } + let(:td_lesson_booking) { b = LessonBooking.book_test_drive(user, teacher, [slot1, slot2], "Hey I've heard of you before."); b.card_presumed_ok = true; b.save!; b } + let(:td_lesson_session) { td_lesson_booking.lesson_sessions[0] } describe "counter" do describe "recurring" do @@ -215,6 +217,21 @@ describe LessonSession do end describe "autocancel" do + it "returns credit" do + + jamclass_credits = user.jamclass_credits + + td_lesson_session.status.should eql LessonSession::STATUS_REQUESTED + + Timecop.travel(Date.today + 10) + + td_lesson_session.autocancel + td_lesson_session.reload + td_lesson_session.status.should eql LessonSession::STATUS_UNCONFIRMED + td_lesson_session.lesson_booking.status.should eql LessonSession::STATUS_UNCONFIRMED + user.reload + user.jamclass_credits.should eql (jamclass_credits + 1) + end it "can't autocancel in the past" do lesson_session.status.should eql LessonSession::STATUS_REQUESTED diff --git a/web/app/assets/javascripts/ftue.js b/web/app/assets/javascripts/ftue.js index ec8d37e4e..54ee2c1a0 100644 --- a/web/app/assets/javascripts/ftue.js +++ b/web/app/assets/javascripts/ftue.js @@ -495,7 +495,7 @@ */ function loadAudioDrivers() { var drivers = context.jamClient.FTUEGetDevices(false); - var chatDrivers = jamClient.FTUEGetChatInputs(); + var chatDrivers = jamClient.FTUEGetChatInputs(false, false); var optionsHtml = ''; var chatOptionsHtml = ''; diff --git a/web/app/assets/javascripts/react-components/AccountOnboarderScreen.js.jsx.coffee b/web/app/assets/javascripts/react-components/AccountOnboarderScreen.js.jsx.coffee index d9a45305a..ca1cc2083 100644 --- a/web/app/assets/javascripts/react-components/AccountOnboarderScreen.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/AccountOnboarderScreen.js.jsx.coffee @@ -149,8 +149,14 @@ profileUtils = context.JK.ProfileUtils value = $target.val() options = {id: id} options[field] = value + @postUpdate(field, value) @queueUpdate(options) + postUpdate: (field, value) -> + if field == 'onboarding_onboarded_at' + console.log("onboarding onboarded at set") + context.JK.Banner.showAlert({title: "One Last Thing", html: "Please send this student Email #5 right now.

This is a critical email, and if you don't send it now, you'll forget. Thanks!"}); + queueUpdate: (update) -> @updates.push(update) @onUpdate() diff --git a/web/app/assets/javascripts/wizard/gear_utils.js b/web/app/assets/javascripts/wizard/gear_utils.js index 6f438dfd8..a1002a24e 100644 --- a/web/app/assets/javascripts/wizard/gear_utils.js +++ b/web/app/assets/javascripts/wizard/gear_utils.js @@ -354,7 +354,31 @@ var musicPorts = jamClient.FTUEGetChannels(); //var chatsOnCurrentDevice = context.jamClient.FTUEGetChatInputs(true); - var chatsOnOtherDevices = context.jamClient.FTUEGetChatInputs(false); + var chatsOnOtherDevices = context.jamClient.FTUEGetChatInputs(false, false); + + // remove all virtual/remote junk form chat inputs. Their key contains' JamKazam when it's Virtual Input or Remote + Object.keys(chatsOnOtherDevices).forEach(function(key) { + if(key.indexOf('JamKazam') > -1) { + delete chatsOnOtherDevices[key] + } + } ) + + // this wasapi logic is this: if there are any non-WASAPI items, present only them, because WASAPI is very high latency and + // highly desirable. But if the user ONLY has wasapi, then fine, we show them (by not deleting them from the list) + var allWasapi = true; + context._.each(chatsOnOtherDevices, function (chatChannelName, chatChannelId) { + if(chatChannelName.indexOf('WASAPI') == -1) { + allWasapi = false; + return false + } + }) + if(!allWasapi) { + Object.keys(chatsOnOtherDevices).forEach(function(key) { + if(chatsOnOtherDevices[key].indexOf('WASAPI') > -1) { + delete chatsOnOtherDevices[key] + } + } ) + } var chatInputs = []; //context._.each(musicPorts.inputs, function(input) {