diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2015-03-18 21:31:13 +0000 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2015-03-18 21:31:13 +0000 |
commit | af365f6c6eb27f8e3680afca52aa70550e992f6f (patch) | |
tree | 916995cd6cf0e3929118332bbb0972e33eb70f1a | |
parent | bb9d542481dba42795d16fe7572b687611b81600 (diff) | |
download | sariulclocks-af365f6c6eb27f8e3680afca52aa70550e992f6f.tar.gz |
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.
-rw-r--r-- | assets/js/main.js | 7 |
1 files changed, 6 insertions, 1 deletions
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(); } |