From 0441d5b81e469381182f27cdfbd0597cb585c9a2 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Fri, 1 Aug 2014 21:30:46 +0200 Subject: [PATCH] add qutoas script counter --- teleforma/exam/models.py | 6 +++++- teleforma/exam/templates/exam/quotas.html | 2 ++ teleforma/exam/templates/exam/script_form.html | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/teleforma/exam/models.py b/teleforma/exam/models.py index 181b8048..75af0ae1 100644 --- a/teleforma/exam/models.py +++ b/teleforma/exam/models.py @@ -131,11 +131,15 @@ class Quota(models.Model): def __unicode__(self): 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() + @property def level(self): if self.value: if self.value != 0: - level = 100*self.corrector.corrector_scripts.filter(Q(status=2) | Q(status=3) | Q(status=4) | Q(status=5)).count()/self.value + level = 100*self.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 6786d84d..f71b6e24 100644 --- a/teleforma/exam/templates/exam/quotas.html +++ b/teleforma/exam/templates/exam/quotas.html @@ -23,6 +23,7 @@ {% trans "date end"%} {% trans "Value"%} {% trans "Level"%} (%) + {% trans "Marked"%} (%) @@ -34,6 +35,7 @@ {{ quota.date_end }} {{ quota.value }} {{ quota.level|floatformat }} + {{ quota.count }} {% endfor %} diff --git a/teleforma/exam/templates/exam/script_form.html b/teleforma/exam/templates/exam/script_form.html index 607d6a92..57a31d06 100644 --- a/teleforma/exam/templates/exam/script_form.html +++ b/teleforma/exam/templates/exam/script_form.html @@ -60,7 +60,7 @@
- {% trans "Submit" %} + {% trans "Submit" %} loading


-- 2.39.5