summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormahesh2016-04-27 00:15:17 +0530
committermahesh2016-05-04 11:21:46 +0530
commit7b0764cc8e6e03fee849c9d72bada7abb4e109e9 (patch)
tree47e1de41d05d565dace3812b5e35e9ffb4be04be
parent2537f5cf9ed24009eda1fe21dd2cda91574ca60e (diff)
downloadonline_test-7b0764cc8e6e03fee849c9d72bada7abb4e109e9.tar.gz
online_test-7b0764cc8e6e03fee849c9d72bada7abb4e109e9.tar.bz2
online_test-7b0764cc8e6e03fee849c9d72bada7abb4e109e9.zip
added manager methods for grade user
-rw-r--r--yaksh/models.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index a4ea6c3..86d718e 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -499,6 +499,19 @@ class AnswerPaperManager(models.Manager):
def get_total_attempt(self, questionpaper, user):
return self.filter(question_paper=questionpaper, user=user).count()
+ def get_users_for_questionpaper(self, questionpaper_id):
+ return self.get_answerpapers_for_quiz(questionpaper_id)\
+ .values("user__id", "user__first_name", "user__last_name")\
+ .distinct()
+
+ def get_user_all_attempts(self, questionpaper, user):
+ return self.filter(question_paper=questionpaper, user=user)\
+ .order_by('-attempt_number')
+
+ def get_user_all_attempts(self, questionpaper,user):
+ return self.filter(question_paper=questionpaper, user= user).order_by('-attempt_number')
+
+
###############################################################################
class AnswerPaper(models.Model):
"""A answer paper for a student -- one per student typically.
@@ -695,5 +708,3 @@ class TestCase(models.Model):
# Test case Expected answer in list form
expected_answer = models.TextField(blank=True, null = True)
-
-