Patchwork [bitbake-devel,5/6] toastergui: fix built ETA calculation

login
register
mail settings
Submitter Alexandru DAMIAN
Date June 12, 2014, 1:52 p.m.
Message ID <dc1daae51ef5201475b5c1a69d966ae57b66dcb6.1402580802.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/73669/
State New
Headers show

Comments

Alexandru DAMIAN - June 12, 2014, 1:52 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

We fix the calculation showing the estimated time
to build completion.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 lib/toaster/toastergui/views.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch

diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index 686cd5c..b38d260 100755
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -230,11 +230,10 @@  def builds(request):
             b.completeper = tf.exclude(order__isnull=True).count()*100/tf.count()
         else:
             b.completeper = 0
-        b.eta = timezone.now()
+
+        b.eta = 0
         if b.completeper > 0:
-            b.eta += ((timezone.now() - b.started_on)*100/b.completeper)
-        else:
-            b.eta = 0
+            b.eta = timezone.now() + ((timezone.now() - b.started_on)*(100-b.completeper)/b.completeper)
 
     # set up list of fstypes for each build
     fstypes_map = {};