[bitbake-devel] [PATCH 29/38] toaster: models Exclude the CANCELLED builds from get_number_of_builds

Michael Wood michael.g.wood at intel.com
Wed Apr 6 16:46:39 UTC 2016


Don't count CANCELLED builds when returning the number of builds.

Signed-off-by: Michael Wood <michael.g.wood at intel.com>
---
 lib/toaster/orm/models.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index dfa69a3..68c3072 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -197,7 +197,10 @@ class Project(models.Model):
     def get_number_of_builds(self):
         """Return the number of builds which have ended"""
 
-        return self.build_set.filter(~Q(outcome=Build.IN_PROGRESS)).count()
+        return self.build_set.exclude(
+            Q(outcome=Build.IN_PROGRESS) |
+            Q(outcome=Build.CANCELLED)
+        ).count()
 
     def get_last_build_id(self):
         try:
-- 
2.1.4




More information about the bitbake-devel mailing list