From: Elliot Smith Date: Fri, 4 Sep 2015 09:37:45 +0000 (+0100) Subject: toaster: Show correct builds count on project pages X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=455a0087e0dcd74998abd02a110942f25da127be;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git toaster: Show correct builds count on project pages The counter for completed builds on the project pages includes builds in progress. Instead use the completedbuilds queryset to count the number of completed builds for display on project pages. Modify how the completedbuilds queryset is constructed so it only excludes builds with status "in progress". Signed-off-by: Elliot Smith Signed-off-by: brian avery Signed-off-by: Richard Purdie --- diff --git a/lib/toaster/toastergui/static/js/base.js b/lib/toaster/toastergui/static/js/base.js index e0df4639799..895e61b2aae 100644 --- a/lib/toaster/toastergui/static/js/base.js +++ b/lib/toaster/toastergui/static/js/base.js @@ -57,8 +57,8 @@ function basePageInit(ctx) { if ($(".total-builds").length !== 0){ libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, function(prjInfo){ - if (prjInfo.builds) - $(".total-builds").text(prjInfo.builds.length); + if (prjInfo.completedbuilds) + $(".total-builds").text(prjInfo.completedbuilds.length); }); } diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py index 45a56117246..67c84b29342 100755 --- a/lib/toaster/toastergui/views.py +++ b/lib/toaster/toastergui/views.py @@ -2263,7 +2263,7 @@ if True: context = { "project" : prj, "lvs_nos" : Layer_Version.objects.all().count(), - "completedbuilds": Build.objects.filter(project_id = pid).filter(outcome__lte = Build.IN_PROGRESS), + "completedbuilds": Build.objects.exclude(outcome = Build.IN_PROGRESS).filter(project_id = pid), "prj" : {"name": prj.name, }, "buildrequests" : prj.build_set.filter(outcome=Build.IN_PROGRESS), "builds" : _project_recent_build_list(prj),