[Toaster] [PATCH 1/4] toaster: orm Fix get_number_of_builds to all apart from IN_PROGRESS

Smith, Elliot elliot.smith at intel.com
Fri Nov 13 05:50:03 PST 2015


On 10 November 2015 at 12:39, Michael Wood <michael.g.wood at intel.com> wrote:

> A projects builds should be counted apart from those which are currently in
> progress.
>

I've submitted this and the other patches to bitbake-devel (I couldn't find
any trace of the cover letter to respond to).

I will add these patches to toaster-next shortly.

Elliot


>
> 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
>
> --
> _______________________________________________
> toaster mailing list
> toaster at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/toaster
>



-- 
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/toaster/attachments/20151113/a91b5ac8/attachment.html>


More information about the toaster mailing list