]> git.parisson.com Git - teleforma.git/commitdiff
add pending scripts to quotas
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 1 Aug 2014 21:20:07 +0000 (23:20 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 1 Aug 2014 21:20:07 +0000 (23:20 +0200)
teleforma/exam/models.py
teleforma/exam/templates/exam/quotas.html

index aa807d6f7a6d6bc6db7ca8ae7e44e5c29f686644..718b1750df22803509cdb4faffadeb80adc4baac 100644 (file)
@@ -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
index 2c6e73b3c400c14ee1f1f6bbc67329e561057368..4f8b8ff26535297c57d4f22f970a4960ea6abf83 100644 (file)
@@ -21,6 +21,7 @@
     <th>{% trans "Course"%}</th>
     <th>{% trans "date start"%}</th>
     <th>{% trans "date end"%}</th>
+    <th>{% trans "Pending"%}</th>
     <th>{% trans "Marked"%}</th>
     <th>{% trans "Value"%}</th>
     <th>{% trans "Level"%} (%)</th>
@@ -33,7 +34,8 @@
      <td>{{ quota.course.title }}</td>
      <td>{{ quota.date_start }}</td>
      <td>{{ quota.date_end }}</td>
-     <td>{{ quota.count }}</td>
+     <td>{{ quota.pending_script_count }}</td>
+     <td>{{ quota.marked_script_count }}</td>
      <td>{{ quota.value }}</td>
      <td>{{ quota.level|floatformat }}</td>
     </tr>