summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorprathamesh2016-11-17 13:58:51 +0530
committerprathamesh2016-11-17 13:58:51 +0530
commit93b16753ded5f3ef07187e9413c94bd52f2e77f7 (patch)
treef137a0fd2a3036c5a6e87d323d8d14ee3d480c0b /yaksh/views.py
parent6ac9e99453543e6a5533f5ab77c7db3c08cc0cf9 (diff)
parentaa6ed71496c4a36faed9b42104c8426345bdc2e3 (diff)
downloadonline_test-93b16753ded5f3ef07187e9413c94bd52f2e77f7.tar.gz
online_test-93b16753ded5f3ef07187e9413c94bd52f2e77f7.tar.bz2
online_test-93b16753ded5f3ef07187e9413c94bd52f2e77f7.zip
Merge branch 'master' of https://github.com/FOSSEE/online_test into student-interface
Resolved Conflicts: yaksh/templates/yaksh/question.html Added testarea back for now.
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 1afcef7..c3d743b 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -517,11 +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['weight'] /
+ question.get_maximum_test_case_weight()) \
+ 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['weight'] /
+ question.get_maximum_test_case_weight()) \
+ if question.partial_grading and question.type == 'code' else 0
new_answer.save()
paper.update_marks('inprogress')
paper.set_end_time(timezone.now())