summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-02-12 12:39:08 +0530
committerPrabhu Ramachandran2016-02-12 12:39:08 +0530
commite1009230a8d3bf2cf3385b478cd5f7f48d8dca25 (patch)
treefa0e7e89d30bdcc9bc8f577097223ee6c9e1e50a
parentb626dbd94ea6342e5257bd5c79d47e9821b3fdde (diff)
parent9830ae48d9b8e062796fea6d134f58fe64425e88 (diff)
downloadonline_test-e1009230a8d3bf2cf3385b478cd5f7f48d8dca25.tar.gz
online_test-e1009230a8d3bf2cf3385b478cd5f7f48d8dca25.tar.bz2
online_test-e1009230a8d3bf2cf3385b478cd5f7f48d8dca25.zip
Merge pull request #71 from ankitjavalkar/answer-submit-bug
Fix bug: Double submission of answers
-rw-r--r--yaksh/settings.py4
-rw-r--r--yaksh/views.py14
2 files changed, 4 insertions, 14 deletions
diff --git a/yaksh/settings.py b/yaksh/settings.py
index 4b1828e..63bd875 100644
--- a/yaksh/settings.py
+++ b/yaksh/settings.py
@@ -21,8 +21,8 @@ URL_ROOT = ''
code_evaluators = {
"python": "python_code_evaluator.PythonCodeEvaluator",
- "c": "c_cpp_code_evaluator.CCPPCodeEvaluator",
- "cpp": "c_cpp_code_evaluator.CCPPCodeEvaluator",
+ "c": "cpp_code_evaluator.CppCodeEvaluator",
+ "cpp": "cpp_code_evaluator.CppCodeEvaluator",
"java": "java_code_evaluator.JavaCodeEvaluator",
"bash": "bash_code_evaluator.BashCodeEvaluator",
"scilab": "scilab_code_evaluator.ScilabCodeEvaluator",
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.