summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2019-09-07 14:46:47 +0200
committerChris Schlaeger <chris@linux.com>2019-09-07 14:46:47 +0200
commit150922ad79e5775d4c379af64b076eb40fc228ba (patch)
treec6616a18c29041e0b8e939854c464650e6198544
parentefc550679284ad14203f186b0e52024dd8858600 (diff)
downloadpostrunner-150922ad79e5775d4c379af64b076eb40fc228ba.zip
Fix: Show session and lap average pace for newer FIT files.
-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' : ''}"