From e11994741fc82879e5e4cc6dc68c513ad3d2a59c Mon Sep 17 00:00:00 2001 From: evgfilim1 Date: Sun, 19 Aug 2018 15:52:32 +0500 Subject: [PATCH] Prevent sending answers when the user has already finished the test --- static/js/result.js | 4 ---- utils.py | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/static/js/result.js b/static/js/result.js index f312722..220fb15 100644 --- a/static/js/result.js +++ b/static/js/result.js @@ -1,7 +1,3 @@ -$(document).ready(function () { - uploadAllAnswers(); -}); - $('.answer').addClass('disabled'); $('.answered').toggleClass('btn-outline-primary btn-danger'); $('.correct').toggleClass('btn-outline-primary btn-success'); diff --git a/utils.py b/utils.py index dd98ef0..43c0375 100644 --- a/utils.py +++ b/utils.py @@ -20,6 +20,8 @@ def save_answer(answer_id, user_id=None): user = get_user(user_id) if answer_id is None or user is None: return False + if user.end_time is not None: + return True # just ignore answer = Answer.query.get(answer_id) if answer is None: # TODO: log this, maybe it was right