summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorankitjavalkar2016-02-11 15:41:32 +0530
committerankitjavalkar2016-02-11 15:41:32 +0530
commit9830ae48d9b8e062796fea6d134f58fe64425e88 (patch)
treefa0e7e89d30bdcc9bc8f577097223ee6c9e1e50a /yaksh/views.py
parentb626dbd94ea6342e5257bd5c79d47e9821b3fdde (diff)
downloadonline_test-9830ae48d9b8e062796fea6d134f58fe64425e88.tar.gz
online_test-9830ae48d9b8e062796fea6d134f58fe64425e88.tar.bz2
online_test-9830ae48d9b8e062796fea6d134f58fe64425e88.zip
Fix bug: Double submission of answers
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 99e9f3b..0f6675a 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -833,7 +833,7 @@ def start(request, attempt_num=None, questionpaper_id=None):
user_dir = get_user_dir(user)
return start(request, attempt_num, questionpaper_id)
-@login_required
+
def get_questions(paper):
'''
Takes answerpaper as an argument. Returns the total questions as
@@ -912,13 +912,6 @@ def show_question(request, q_id, attempt_num, questionpaper_id, success_msg=None
question_paper=q_paper)
if not user.is_authenticated() or paper.end_time < datetime.datetime.now():
return my_redirect('/exam/login/')
- old_qid = request.POST.get('question_id')
- if old_qid is not None:
- quest = Question.objects.get(pk=old_qid)
- user_code = request.POST.get('answer')
- if quest.type == 'code':
- old_skipped = paper.answers.filter(question=quest, skipped=True)
- _save_skipped_answer(old_skipped, user_code, paper, quest)
if len(q_id) == 0:
msg = 'Congratulations! You have successfully completed the quiz.'
return complete(request, msg, attempt_num, questionpaper_id)
@@ -1019,9 +1012,6 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None):
if not paper.question_paper.quiz.active:
reason = 'The quiz has been deactivated!'
return complete(request, reason, attempt_num, questionpaper_id)
- if not paper.question_paper.quiz.active:
- reason = 'The quiz has been deactivated!'
- return complete(request, reason, attempt_num, questionpaper_id)
questions, to_attempt, submitted = get_questions(paper)
old_answer = paper.answers.filter(question=question, skipped=True)
if old_answer:
@@ -1209,7 +1199,7 @@ def monitor(request, questionpaper_id=None):
context_instance=ci)
-@login_required
+
def get_user_data(username):
"""For a given username, this returns a dictionary of important data
related to the user including all the user's answers submitted.