The count of a project's builds should not include those which are
currently in progress.
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>
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: