bitbake: toaster: orm Fix get_number_of_builds to count all apart from IN_PROGRESS

The count of a project's builds should not include those which are
currently in progress.

(Bitbake rev: a981700701c41c7bbb6a9778e95f691278c5c294)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Michael Wood
2015-11-13 13:48:34 +00:00
committed by Richard Purdie
parent c4032f479e
commit 5fa4c73603

View File

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