From af365f6c6eb27f8e3680afca52aa70550e992f6f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 18 Mar 2015 21:31:13 +0000 Subject: reset time wasting clock at start of lesson, not end Otherwise if the user inputs a wrong password the time wasted will get wiped out before it's submitted. This is a hack: should probably use a cookie to keep the time safe in between server connections. --- assets/js/main.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/js/main.js b/assets/js/main.js index 1586c5c..5ab3902 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -89,6 +89,9 @@ function startLesson() // set the cookie and reload to start the session createCookie("class_cookie", cookieString, 1); + // reset clock because it's currently dangerous to do so when + // ending a lesson + timeWastingClock.reset(); // reload, preventing Firefox from resubmitting POST data window.location.assign(document.URL.split("#")[0]); } @@ -124,7 +127,9 @@ function endLesson() // submit timeWastingClock.stop(); - timeWastingClock.reset(); + // dangerous to reset clock here in case user inputs wrong + // password: instead reset when *starting* a class + // timeWastingClock.reset(); $form.submit(); } -- cgit v1.2.3