]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: models Exclude the CANCELLED builds from get_number_of_builds
authorMichael Wood <michael.g.wood@intel.com>
Wed, 6 Apr 2016 16:46:39 +0000 (17:46 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 6 Apr 2016 22:00:10 +0000 (23:00 +0100)
Don't count CANCELLED builds when returning the number of builds.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/toaster/orm/models.py

index 7598744a24288fcc0bcd0166f7f2907021dc7a4a..2a01184a7328601cb2634c5d7a31c15fa8c5caa6 100644 (file)
@@ -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: