summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorankitjavalkar2016-11-02 16:02:03 +0530
committerankitjavalkar2016-11-10 12:43:14 +0530
commit053e27000540396b84c26d5a5f593d4389e0787a (patch)
tree0d48b337b2bc1e615b436784d78edf2daba08791 /yaksh/views.py
parent7ae8584a4f4d095e005d6239102c0f26611ac006 (diff)
downloadonline_test-053e27000540396b84c26d5a5f593d4389e0787a.tar.gz
online_test-053e27000540396b84c26d5a5f593d4389e0787a.tar.bz2
online_test-053e27000540396b84c26d5a5f593d4389e0787a.zip
dd basic partial marking feature per test case
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 1afcef7..2478544 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -517,11 +517,14 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None):
if question.type == 'code' else None
correct, result = paper.validate_answer(user_answer, question, json_data)
if correct:
+ new_answer.marks = question.points * result['marks'] if question.partial_grading \
+ and question.type == 'code' else question.points
new_answer.correct = correct
- new_answer.marks = question.points
new_answer.error = result.get('error')
else:
new_answer.error = result.get('error')
+ new_answer.marks = question.points * result['marks'] if question.partial_grading \
+ and question.type == 'code' else question.points
new_answer.save()
paper.update_marks('inprogress')
paper.set_end_time(timezone.now())