From: <dg...@us...> - 2011-03-11 09:18:45
|
Revision: 767 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=767&view=rev Author: dgranda Date: 2011-03-11 09:18:39 +0000 (Fri, 11 Mar 2011) Log Message: ----------- Preventing pytrainer to fail when dealing with wrong (corrupted?) data Modified Paths: -------------- pytrainer/trunk/pytrainer/stats.py Modified: pytrainer/trunk/pytrainer/stats.py =================================================================== --- pytrainer/trunk/pytrainer/stats.py 2011-03-11 00:40:53 UTC (rev 766) +++ pytrainer/trunk/pytrainer/stats.py 2011-03-11 09:18:39 UTC (rev 767) @@ -65,9 +65,13 @@ data['sports'][r['sport']]['total_'+f] = 0 for f in fields: data['sports'][r['sport']][f] = max(data['sports'][r['sport']][f], r[f]) - data['sports'][r['sport']]['total_'+f] += r[f] - data[f] = max(data[f], r[f]) + if r[f] is not None: + data['sports'][r['sport']]['total_'+f] += r[f] + data[f] = max(data[f], r[f]) + else: + logging.info('Skipping null values') + data['total_duration'] += r['duration'] data['total_distance'] += r['distance'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |