bitbake: toaster: models Exclude the CANCELLED builds from get_number_of_builds

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

(Bitbake rev: c3c29fd4eb5116b771e8e16281d4e3cdf4fae165)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Michael Wood
2016-04-06 17:46:39 +01:00
committed by Richard Purdie
parent 296d3733df
commit f4cee8840e

View 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: