summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorprathamesh2018-01-02 16:46:52 +0530
committerprathamesh2018-01-02 16:46:52 +0530
commite14514e01052fb36cd9f14675cbe7ca940945a34 (patch)
tree994f3d5dd6d8c4f3614d3b1a655c91caa7426dcf /yaksh/views.py
parent7fe8e17438b8e67e7290f11ddcd29cda3953921b (diff)
downloadonline_test-e14514e01052fb36cd9f14675cbe7ca940945a34.tar.gz
online_test-e14514e01052fb36cd9f14675cbe7ca940945a34.tar.bz2
online_test-e14514e01052fb36cd9f14675cbe7ca940945a34.zip
Allowed user to skip and view solution if the answer is correct.
Added solution attribute to the Question model.
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 302ef9e..fd07ade 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -568,7 +568,7 @@ def show_question(request, question, paper, error_message=None, notification=Non
delay_time = paper.time_left_on_question(question)
if previous_question and quiz.is_exercise:
- if delay_time <= 0:
+ if delay_time <= 0 or previous_question in paper.questions_answered.all():
can_skip = True
question = previous_question
if not question:
@@ -639,9 +639,8 @@ def skip(request, q_id, next_q=None, attempt_num=None, questionpaper_id=None,
question = get_object_or_404(Question, pk=q_id)
if paper.question_paper.quiz.is_exercise:
- if paper.time_left_on_question(question) <= 0:
- paper.start_time = timezone.now()
- paper.save()
+ paper.start_time = timezone.now()
+ paper.save()
if request.method == 'POST' and question.type == 'code':
if not paper.answers.filter(question=question, correct=True).exists():
@@ -775,7 +774,7 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None,
user_answer, current_question, json_data, uid
)
if current_question.type in ['code', 'upload']:
- if paper.time_left() <= 0:
+ if paper.time_left() <= 0 and not paper.question_paper.quiz.is_exercise:
url = 'http://localhost:%s' % SERVER_POOL_PORT
result_details = get_result_from_code_server(url, uid, block=True)
result = json.loads(result_details.get('result'))