From f93527f83ff0b6d87cd9ffb10aac3cbb27d08b8a Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Wed, 18 Jan 2017 02:42:29 +0530 Subject: Can download csv of students' performance per course Moderator can now download the csv dump of the performance of students in each quiz (best attempt of the quiz) for a course. --- yaksh/models.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index ad61872..31038f1 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -221,6 +221,13 @@ class Course(models.Model): success = False return success + def get_only_students(self): + teachers = list(self.teachers.all().values_list("id", flat=True)) + teachers.append(self.creator.id) + students = self.students.exclude(id__in=teachers) + return students + + def __str__(self): return self.name @@ -900,6 +907,15 @@ class AnswerPaperManager(models.Manager): data['questionpaperid'] = questionpaper_id return data + def get_user_best_of_attempts_marks(self, quiz, user_id): + best_attempt = 0.0 + papers = self.filter(question_paper__quiz=quiz, + user=user_id).values("marks_obtained") + if papers: + best_attempt = max([marks["marks_obtained"] for marks in papers]) + return best_attempt + + ############################################################################### class AnswerPaper(models.Model): -- cgit From 1f66352c1f26eb0688ae0884781e6a6a66d43b18 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Wed, 18 Jan 2017 15:01:02 +0530 Subject: added bootstrap labels instead of mark tag --- yaksh/models.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 31038f1..8d4f930 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -227,7 +227,6 @@ class Course(models.Model): students = self.students.exclude(id__in=teachers) return students - def __str__(self): return self.name @@ -915,8 +914,6 @@ class AnswerPaperManager(models.Manager): best_attempt = max([marks["marks_obtained"] for marks in papers]) return best_attempt - - ############################################################################### class AnswerPaper(models.Model): """A answer paper for a student -- one per student typically. -- cgit