diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-31 22:00:00 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-31 22:00:00 +0200 |
commit | a42aecfbc1c890baae64e5eda720e5a2836c26e3 (patch) | |
tree | acc3722f9c13b507d45a60d9aa1a477950eb4ee5 | |
parent | 57d3051914f47ecc30055f87cd90ba665a7acb19 (diff) | |
download | postrunner-a42aecfbc1c890baae64e5eda720e5a2836c26e3.zip |
Fix: Don't show empty map when some data points have no GPS data
-rw-r--r-- | lib/postrunner/TrackView.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/postrunner/TrackView.rb b/lib/postrunner/TrackView.rb index 4a914c0..7171706 100644 --- a/lib/postrunner/TrackView.rb +++ b/lib/postrunner/TrackView.rb @@ -117,19 +117,19 @@ EOT def track_points(script) first = true @activity.fit_activity.sessions.each do |session| - session.laps.each do |lap| - lap.records.each do |record| - long = record.position_long - lat = record.position_lat - if first - first = false - else - script << "," - end - script << <<"EOT" + session.records.each do |record| + long = record.position_long + lat = record.position_lat + next unless long && lat + + if first + first = false + else + script << "," + end + script << <<"EOT" new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(#{long}, #{lat}).transform(geographic, mercator)) EOT - end end end end |