diff --git a/web/app/assets/javascripts/JamServer.js b/web/app/assets/javascripts/JamServer.js index 7b523dbb5..8985822ff 100644 --- a/web/app/assets/javascripts/JamServer.js +++ b/web/app/assets/javascripts/JamServer.js @@ -175,7 +175,7 @@ function _heartbeat() { if (app.heartbeatActive) { - console.log("heartbeat active?: " + active) + //console.log("heartbeat active?: " + active) var message = context.JK.MessageFactory.heartbeat(notificationLastSeen, notificationLastSeenAt, active); notificationLastSeenAt = undefined; notificationLastSeen = undefined; diff --git a/web/app/assets/javascripts/profile_utils.js b/web/app/assets/javascripts/profile_utils.js index 565892090..34c38bf9b 100644 --- a/web/app/assets/javascripts/profile_utils.js +++ b/web/app/assets/javascripts/profile_utils.js @@ -130,6 +130,13 @@ // Blank value is valid: return "" } + + clientValue = clientValue.trim() + // remove leading $ if present + if (clientValue.indexOf('$') == 0) { + clientValue = clientValue.substring(1) + } + var money = new Number(clientValue); if(!context._.isNaN(money)) { @@ -137,7 +144,7 @@ } else { // restore original value to allow server to reject with validation error - money = clientValue; + money = ''; } return money; } diff --git a/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee b/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee index 97aa11ce5..f61b99173 100644 --- a/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee @@ -99,8 +99,14 @@ rest = window.JK.Rest() captureCurrency: (e) -> for minutes in [30, 45, 60, 90, 120] - pricePerLessonCents = context.JK.ProfileUtils.normalizeMoneyForSubmit($("[name='price_per_lesson_#{minutes}_cents']", @root).val()) - pricePerMonthCents = context.JK.ProfileUtils.normalizeMoneyForSubmit($("[name='price_per_month_#{minutes}_cents']", @root).val()) + lessonValue = $("[name='price_per_lesson_#{minutes}_cents']", @root).val() + monthlyValue = $("[name='price_per_month_#{minutes}_cents']", @root).val() + + + pricePerLessonCents = context.JK.ProfileUtils.normalizeMoneyForSubmit(lessonValue) + pricePerMonthCents = context.JK.ProfileUtils.normalizeMoneyForSubmit(monthlyValue) + + console.log("minute #{minutes} lessonValue=#{lessonValue} monthlyValue=#{monthlyValue} pricePerLessonCents=#{pricePerLessonCents}, pricePerMonthCents=#{pricePerMonthCents}") this.setState({ "price_per_lesson_#{minutes}_cents": pricePerLessonCents @@ -109,8 +115,8 @@ rest = window.JK.Rest() displayLessonAmount = context.JK.ProfileUtils.normalizeMoneyForDisplay(pricePerLessonCents) displayMonthAmount = context.JK.ProfileUtils.normalizeMoneyForDisplay(pricePerMonthCents) - $("[name='price_per_lesson_#{minutes}_cents']", @root).val(displayLessonAmount) - $("[name='price_per_month_#{minutes}_cents']", @root).val(displayMonthAmount) + #$("[name='price_per_lesson_#{minutes}_cents']", @root).val(displayLessonAmount) + #$("[name='price_per_month_#{minutes}_cents']", @root).val(displayMonthAmount) navDestination: (instructions) -> navTo=null @@ -201,7 +207,7 @@ rest = window.JK.Rest()