changeset 1181:36b12336cb7f beta

added percentage of progress of gathered commit activity statistics
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 28 Mar 2011 00:06:18 +0200
parents c5e330c4ed65
children a9550b59db90
files rhodecode/controllers/summary.py rhodecode/templates/summary/summary.html
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/summary.py	Sun Mar 27 17:12:59 2011 +0200
+++ b/rhodecode/controllers/summary.py	Mon Mar 28 00:06:18 2011 +0200
@@ -126,6 +126,7 @@
             .filter(Statistics.repository == dbrepo)\
             .scalar()
 
+        c.stats_percentage = 0
 
         if stats and stats.languages:
             c.no_data = False is dbrepo.enable_statistics
@@ -137,6 +138,14 @@
                                             key=lambda k: k[1])[:10]
                                         )
                                     )
+            last_rev = stats.stat_on_revision
+            c.repo_last_rev = c.rhodecode_repo.count() - 1 \
+                if c.rhodecode_repo.revisions else 0
+            if last_rev == 0 or c.repo_last_rev == 0:
+                pass
+            else:
+                c.stats_percentage = '%.2f' % ((float((last_rev)) /
+                                                c.repo_last_rev) * 100)
         else:
             c.commit_data = json.dumps({})
             c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 10] ])
--- a/rhodecode/templates/summary/summary.html	Sun Mar 27 17:12:59 2011 +0200
+++ b/rhodecode/templates/summary/summary.html	Mon Mar 28 00:06:18 2011 +0200
@@ -301,13 +301,17 @@
     </div>
     
     <div class="table">
+         <div style="padding:0 10px 10px 15px;font-size: 1.2em;">
          %if c.no_data:
-           <div style="padding:0 10px 10px 15px;font-size: 1.2em;">${c.no_data_msg}
+           ${c.no_data_msg}
            %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
                 [${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name))}]
            %endif         
-           </div>
-        %endif:  
+           
+        %else:
+            ${_('Loaded in')} ${c.stats_percentage} %
+        %endif
+        </div>  
         <div id="commit_history" style="width:460px;height:300px;float:left"></div>
         <div style="clear: both;height: 10px"></div>
         <div id="overview" style="width:460px;height:100px;float:left"></div>