summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-04-06 17:46:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-06 23:00:10 +0100
commitc3c29fd4eb5116b771e8e16281d4e3cdf4fae165 (patch)
tree9a6aee7a9135bcda65c6a90da5a052210367f3ba
parent6b82ffca1aa9ca2d0feec64b15466bc8ba160011 (diff)
downloadopenembedded-core-contrib-c3c29fd4eb5116b771e8e16281d4e3cdf4fae165.tar.gz
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@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/toaster/orm/models.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 7598744a24..2a01184a73 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: