From 150922ad79e5775d4c379af64b076eb40fc228ba Mon Sep 17 00:00:00 2001 From: Chris Schlaeger Date: Sat, 7 Sep 2019 14:46:47 +0200 Subject: Fix: Show session and lap average pace for newer FIT files. --- lib/postrunner/ActivitySummary.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib') 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' : ''}" -- cgit v1.2.3