Changeset - 5e8c7d78abd5
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2011-01-09 14:03:22
marcin@python-works.com
fixes #98 protection against float division of percentage stats
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/admin/repos.py
Show inline comments
 
@@ -276,25 +276,25 @@ class ReposController(BaseController):
 
                      category='error')
 

	
 
            return redirect(url('repos'))
 

	
 
        if c.repo_info.stats:
 
            last_rev = c.repo_info.stats.stat_on_revision
 
        else:
 
            last_rev = 0
 
        c.stats_revision = last_rev
 

	
 
        c.repo_last_rev = r.revisions[-1] if r.revisions else 0
 

	
 
        if last_rev == 0:
 
        if last_rev == 0 or c.repo_last_rev == 0:
 
            c.stats_percentage = 0
 
        else:
 
            c.stats_percentage = '%.2f' % ((float((last_rev)) /
 
                                            c.repo_last_rev) * 100)
 

	
 
        defaults = c.repo_info.get_dict()
 
        if c.repo_info.user:
 
            defaults.update({'user':c.repo_info.user.username})
 
        else:
 
            replacement_user = self.sa.query(User)\
 
            .filter(User.admin == True).first().username
 
            defaults.update({'user':replacement_user})
0 comments (0 inline, 0 general)