From: <ilo...@us...> - 2011-05-08 20:11:07
|
Revision: 793 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=793&view=rev Author: ilovesquigly Date: 2011-05-08 20:11:00 +0000 (Sun, 08 May 2011) Log Message: ----------- Division by zero bug fix Modified Paths: -------------- pytrainer/trunk/pytrainer/gui/windowmain.py Modified: pytrainer/trunk/pytrainer/gui/windowmain.py =================================================================== --- pytrainer/trunk/pytrainer/gui/windowmain.py 2011-05-08 17:26:44 UTC (rev 792) +++ pytrainer/trunk/pytrainer/gui/windowmain.py 2011-05-08 20:11:00 UTC (rev 793) @@ -1310,10 +1310,11 @@ c += 1 store.set (iter, c, s['total_'+f]) c += 1 - store.set (iter, c, s['total_distance'] / s['total_duration'] * 3600.) - for f in data['fields']: - c += 1 - store.set (iter, c, s[f]) + if s['total_duration']!=0: # Avoid division by zero if 0 length sport activity exists in DB + store.set (iter, c, s['total_distance'] / s['total_duration'] * 3600.) + for f in data['fields']: + c += 1 + store.set (iter, c, s[f]) self.statsTreeView.set_model(store) self.statsTreeView.set_rules_hint(True) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |