[Toaster] [PATCH 1/4] toaster: orm Fix get_number_of_builds to all apart from IN_PROGRESS
Michael Wood
michael.g.wood at intel.com
Tue Nov 10 04:39:03 PST 2015
A projects builds should be counted apart from those which are currently in
progress.
Signed-off-by: Michael Wood <michael.g.wood at intel.com>
---
bitbake/lib/toaster/orm/models.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 3832905..0ac94b9 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -130,13 +130,12 @@ class Project(models.Model):
try:
return self.projectvariable_set.get(name="MACHINE").value
except (ProjectVariable.DoesNotExist,IndexError):
- return( "None" );
+ return None;
def get_number_of_builds(self):
- try:
- return len(Build.objects.filter( project = self.id ))
- except (Build.DoesNotExist,IndexError):
- return( 0 )
+ """Return the number of builds which have ended"""
+
+ return self.build_set.filter(~Q(outcome=Build.IN_PROGRESS)).count()
def get_last_build_id(self):
try:
--
2.5.0
More information about the toaster
mailing list