[bitbake-devel] [PATCH 3/5] toaster: Show correct builds count on project pages

brian avery avery.brian at gmail.com
Thu Sep 10 17:05:17 UTC 2015


From: Elliot Smith <elliot.smith at intel.com>

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 <elliot.smith at intel.com>
Signed-off-by: brian avery <avery.brian at gmail.com>
---
 lib/toaster/toastergui/static/js/base.js | 4 ++--
 lib/toaster/toastergui/views.py          | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/toaster/toastergui/static/js/base.js b/lib/toaster/toastergui/static/js/base.js
index e0df463..895e61b 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 6ff510d..631d619 100755
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -2255,7 +2255,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),
-- 
1.9.1




More information about the bitbake-devel mailing list