summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-31 22:00:00 +0200
committerChris Schlaeger <chris@linux.com>2014-08-31 22:00:00 +0200
commita42aecfbc1c890baae64e5eda720e5a2836c26e3 (patch)
treeacc3722f9c13b507d45a60d9aa1a477950eb4ee5
parent57d3051914f47ecc30055f87cd90ba665a7acb19 (diff)
downloadpostrunner-a42aecfbc1c890baae64e5eda720e5a2836c26e3.zip
Fix: Don't show empty map when some data points have no GPS data
-rw-r--r--lib/postrunner/TrackView.rb22
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