summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorankitjavalkar2016-11-10 12:36:13 +0530
committerankitjavalkar2016-11-10 12:43:14 +0530
commita09df642d4f3623ee517aaed2eac1372ebacc0e0 (patch)
tree7bfb5c55066bf7bda56dfeb02eeb4dbc2f0a2bef /yaksh/views.py
parent4904a8305e7e83a00cef718a42bbbf8e7d5f8740 (diff)
downloadonline_test-a09df642d4f3623ee517aaed2eac1372ebacc0e0.tar.gz
online_test-a09df642d4f3623ee517aaed2eac1372ebacc0e0.tar.bz2
online_test-a09df642d4f3623ee517aaed2eac1372ebacc0e0.zip
Add point based weightage for partial grading instead of percentage based partial grading
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 2478544..aca89ef 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -517,14 +517,16 @@ 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.marks = (question.points * result['weightage'] /
+ question.get_maximum_test_case_weightage()) \
+ if question.partial_grading and question.type == 'code' else question.points
new_answer.correct = correct
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.marks = (question.points * result['weightage'] /
+ question.get_maximum_test_case_weightage()) \
+ if question.partial_grading and question.type == 'code' else 0
new_answer.save()
paper.update_marks('inprogress')
paper.set_end_time(timezone.now())