summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/postrunner/ActivitySummary.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/postrunner/ActivitySummary.rb b/lib/postrunner/ActivitySummary.rb
index b17da0a..a5f14f6 100644
--- a/lib/postrunner/ActivitySummary.rb
+++ b/lib/postrunner/ActivitySummary.rb
@@ -354,12 +354,22 @@ module PostRunner
def local_value(fdr, field, format, units)
unit = units[@unit_system]
value = fdr.get_as(field, unit)
+ if value.nil? && field == 'avg_speed'
+ # New fit files used 'enhanced_avg_speed' instead of the older
+ # 'avg_speed'.
+ value = fdr.get_as('enhanced_avg_speed', unit)
+ end
return '-' unless value
"#{format % [value, unit]}"
end
def pace(fdr, field, show_unit = true)
speed = fdr.get(field)
+ if speed.nil? && field == 'avg_speed'
+ # New fit files used 'enhanced_avg_speed' instead of the older
+ # 'avg_speed'.
+ speed = fdr.get('enhanced_avg_speed')
+ end
case @unit_system
when :metric
"#{speedToPace(speed)}#{show_unit ? ' min/km' : ''}"