summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-05-13 16:24:52 +0530
committerGitHub2020-05-13 16:24:52 +0530
commitf7825eade425cb51ba053763db9d9fd051b0f4ce (patch)
treebc15b6cf7b5bbab4d4c8cfac5dd43abaaf778777 /yaksh
parentb8636965de8a86e68fd542754678e6826c7e5eac (diff)
parent833b96ac49499810934ada8ba02750623455d0cd (diff)
downloadonline_test-f7825eade425cb51ba053763db9d9fd051b0f4ce.tar.gz
online_test-f7825eade425cb51ba053763db9d9fd051b0f4ce.tar.bz2
online_test-f7825eade425cb51ba053763db9d9fd051b0f4ce.zip
Merge branch 'master' into merge_monitor_regrade
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/models.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 9bcb132..64489b8 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1452,6 +1452,19 @@ class Question(models.Model):
tc_list.extend(test_case)
return tc_list
+ def get_test_cases_as_dict(self, **kwargs):
+ tc_list = []
+ for tc in self.testcase_set.values_list("type", flat=True).distinct():
+ test_case_ctype = ContentType.objects.get(app_label="yaksh",
+ model=tc)
+ test_case = test_case_ctype.get_all_objects_for_this_type(
+ question=self,
+ **kwargs
+ )
+ for tc in test_case:
+ tc_list.append(model_to_dict(tc))
+ return tc_list
+
def get_test_case(self, **kwargs):
for tc in self.testcase_set.all():
test_case_type = tc.type
@@ -1743,6 +1756,7 @@ class QuestionPaper(models.Model):
for question_set in self.random_questions.all():
marks += question_set.marks * question_set.num_questions
self.total_marks = marks
+ self.save()
def _get_questions_for_answerpaper(self):
""" Returns fixed and random questions for the answer paper"""