summaryrefslogtreecommitdiff
path: root/testapp/exam
diff options
context:
space:
mode:
authorprathamesh2014-06-05 17:52:48 +0530
committerprathamesh2014-06-05 17:52:48 +0530
commit2ab7f5c798993e06fc35a95e5acda990cb7d2546 (patch)
tree8f385a3e36fc86b9237107f67122362c49220082 /testapp/exam
parent32e019a07de1f9e819e9c1531c50166289c76cb9 (diff)
parent18cd0fa1def34bb320f38062596789f745bee530 (diff)
downloadonline_test-2ab7f5c798993e06fc35a95e5acda990cb7d2546.tar.gz
online_test-2ab7f5c798993e06fc35a95e5acda990cb7d2546.tar.bz2
online_test-2ab7f5c798993e06fc35a95e5acda990cb7d2546.zip
Merge branch 'deploy_server'
Diffstat (limited to 'testapp/exam')
-rw-r--r--testapp/exam/views.py32
1 files changed, 12 insertions, 20 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py
index f24215b..92dd029 100644
--- a/testapp/exam/views.py
+++ b/testapp/exam/views.py
@@ -439,19 +439,17 @@ def automatic_questionpaper(request, questionpaper_id=None):
questions = request.POST.getlist('questions')
tot_marks = 0
for quest in questions:
- if quest.isdigit():
- q = Question.objects.get(id=quest)
- tot_marks += q.points
+ q = Question.objects.get(id=quest)
+ tot_marks += q.points
quest_paper.quiz = quiz
quest_paper.total_marks = tot_marks
quest_paper.save()
for quest in questions:
- if quest.isdigit():
- q = Question.objects.get(id=quest)
- quest_paper.questions.add(q)
+ q = Question.objects.get(id=quest)
+ quest_paper.questions.add(q)
return my_redirect('/exam/manage/showquiz')
else:
- no_questions = int(request.POST.get('questions'))
+ no_questions = int(request.POST.get('num_questions'))
fetched_questions = fetch_questions(request)
n = len(fetched_questions)
msg = ''
@@ -482,18 +480,16 @@ def automatic_questionpaper(request, questionpaper_id=None):
questions = request.POST.getlist('questions')
tot_marks = quest_paper.total_marks
for quest in questions:
- if quest.isdigit():
- q = Question.objects.get(id=quest)
- tot_marks += q.points
+ q = Question.objects.get(id=quest)
+ tot_marks += q.points
quest_paper.total_marks = tot_marks
quest_paper.save()
for quest in questions:
- if quest.isdigit():
- q = Question.objects.get(id=quest)
- quest_paper.questions.add(q)
+ q = Question.objects.get(id=quest)
+ quest_paper.questions.add(q)
return my_redirect('/exam/manage/showquiz')
else:
- no_questions = int(request.POST.get('questions'))
+ no_questions = int(request.POST.get('num_questions'))
fetched_questions = fetch_questions(request)
n = len(fetched_questions)
msg = ''
@@ -532,9 +528,8 @@ def manual_questionpaper(request, questionpaper_id=None):
quiz = Quiz.objects.order_by("-id")[0]
tot_marks = 0
for quest in questions:
- if quest.isdigit():
- q = Question.objects.get(id=quest)
- tot_marks += q.points
+ q = Question.objects.get(id=quest)
+ tot_marks += q.points
quest_paper.quiz = quiz
quest_paper.total_marks = tot_marks
quest_paper.save()
@@ -694,9 +689,6 @@ def question(request, q_id, questionpaper_id, success_msg=None):
if not paper.question_paper.quiz.active:
reason = 'The quiz has been deactivated!'
return complete(request, reason, questionpaper_id)
- #if new:
- # paper.start_time = datetime.datetime.now()
- # paper.end_time = datetime.datetime.now()
time_left = paper.time_left()
if time_left == 0:
return complete(request, reason='Your time is up!')