damned-lies r1316 - in trunk: . stats
- From: claudep svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1316 - in trunk: . stats
- Date: Wed, 7 Jan 2009 13:26:08 +0000 (UTC)
Author: claudep
Date: Wed Jan 7 13:26:08 2009
New Revision: 1316
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1316&view=rev
Log:
2009-01-07 Claude Paroz <claude 2xlibre net>
* stats/models.py: Prevent a division by 0 in stats percentage computing.
Modified:
trunk/ChangeLog
trunk/stats/models.py
Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py (original)
+++ trunk/stats/models.py Wed Jan 7 13:26:08 2009
@@ -780,7 +780,10 @@
for key, categ in stats['categs'].items():
categ['catname'] = Category.get_cat_name(key)
categ['cattotal'] = categ['cattrans'] + categ['catfuzzy'] + categ['catuntrans']
- categ['cattransperc'] = int(100*categ['cattrans']/categ['cattotal'])
+ if categ['cattotal'] > 0:
+ categ['cattransperc'] = int(100*categ['cattrans']/categ['cattotal'])
+ else:
+ categ['cattransperc'] = 0
# Sort modules
mods = [[name,mod] for name, mod in categ['modules'].items()]
mods.sort()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]