Mercurial > kallithea
diff rhodecode/controllers/summary.py @ 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 | 2ab211e0aecd |
children | 6832ef664673 |
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] ])