I updated my local version with your code and tried to run pytrainer to import some activities but something went wrong. After checking logs, I would move `total_duration` calculation out of `if` statement because it will fail in case of no heartrate data:

```
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pytrainer/gui/windowrecord.py", line 248, in on_accept_clicked
    self.update_activity_data(row, activity["rcd_gpxfile"], activity["rcd_sport"])
  File "/usr/lib/python2.7/site-packages/pytrainer/gui/windowrecord.py", line 479, in update_activity_data
    gpx_summary, laps = self.parent.summaryFromGPX(gpx_file, (sport,""))
  File "/usr/lib/python2.7/site-packages/pytrainer/record.py", line 290, in summaryFromGPX
    lap_avg_hr, lap_max_hr = self.hrFromLaps(laps)
  File "/usr/lib/python2.7/site-packages/pytrainer/record.py", line 234, in hrFromLaps
    avg_hr = int(round(ponderate_hr / total_duration))  # ceil?, floor?, round?
ZeroDivisionError: integer division or modulo by zero
```
After moving mentioned line pytrainer can import the activity although no proper average heartrate data is displayed on day tab (nothing is displayed in correspondent field). Surprisingly a correct `0` is displayed in matching field in register tab. Probably a side effect nothing to do with your code, but worth to spend some time to fix it.

I will also check tests provided (not done yet) because it seems strange to me that it failed when no heartrate data is present.