From: Michael Wood Date: Wed, 6 Apr 2016 16:46:39 +0000 (+0100) Subject: toaster: models Exclude the CANCELLED builds from get_number_of_builds X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c3c29fd4eb5116b771e8e16281d4e3cdf4fae165;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 Signed-off-by: Richard Purdie --- diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py index 7598744a242..2a01184a732 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: