From: Guillaume Pellerin Date: Fri, 1 Aug 2014 21:20:07 +0000 (+0200) Subject: add pending scripts to quotas X-Git-Tag: 1.1~319 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=4a509e34450ca2725de8f3fa203e34ef9ca22a13;p=teleforma.git add pending scripts to quotas --- diff --git a/teleforma/exam/models.py b/teleforma/exam/models.py index aa807d6f..718b1750 100644 --- a/teleforma/exam/models.py +++ b/teleforma/exam/models.py @@ -132,14 +132,22 @@ class Quota(models.Model): return ' - '.join([unicode(self.corrector), self.course.title, str(self.value)]) @property - def count(self): - return self.corrector.corrector_scripts.filter(Q(status=2) | Q(status=3) | Q(status=4) | Q(status=5)).count() + def all_script_count(self): + return self.corrector.corrector_scripts.filter(Q(status=3) | Q(status=4) | Q(status=5)).count() + + @property + def pending_script_count(self): + return self.corrector.corrector_scripts.filter(Q(status=3)).count() + + @property + def marked_script_count(self): + return self.corrector.corrector_scripts.filter(Q(status=4) | Q(status=5)).count() @property def level(self): if self.value: if self.value != 0: - level = 100*self.count/self.value + level = 100*self.all_script_count/self.value return level else: return 0 diff --git a/teleforma/exam/templates/exam/quotas.html b/teleforma/exam/templates/exam/quotas.html index 2c6e73b3..4f8b8ff2 100644 --- a/teleforma/exam/templates/exam/quotas.html +++ b/teleforma/exam/templates/exam/quotas.html @@ -21,6 +21,7 @@ {% trans "Course"%} {% trans "date start"%} {% trans "date end"%} + {% trans "Pending"%} {% trans "Marked"%} {% trans "Value"%} {% trans "Level"%} (%) @@ -33,7 +34,8 @@ {{ quota.course.title }} {{ quota.date_start }} {{ quota.date_end }} - {{ quota.count }} + {{ quota.pending_script_count }} + {{ quota.marked_script_count }} {{ quota.value }} {{ quota.level|floatformat }}