summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh')
-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)
-
-