[oe-commits] [bitbake] 29/45: toaster: models Exclude the CANCELLED builds from get_number_of_builds

git at git.openembedded.org git at git.openembedded.org
Wed Apr 6 22:11:47 UTC 2016


rpurdie pushed a commit to branch master
in repository bitbake.

commit c3c29fd4eb5116b771e8e16281d4e3cdf4fae165
Author: Michael Wood <michael.g.wood at intel.com>
AuthorDate: Wed Apr 6 17:46:39 2016 +0100

    toaster: models Exclude the CANCELLED builds from get_number_of_builds
    
    Don't count CANCELLED builds when returning the number of builds.
    
    Signed-off-by: Michael Wood <michael.g.wood at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 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 7598744..2a01184 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:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list