summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2020-05-31 16:49:08 +0200
committerChris Schlaeger <chris@linux.com>2020-05-31 16:49:08 +0200
commite11e292e9c72e5295b6b9918aaeab62310ef5904 (patch)
treecaf93e6c75861c80f00f4e9d63874782d0cbafa8
parent7af11d92bb0882716815c71c6f77390089777ced (diff)
downloadpostrunner-e11e292e9c72e5295b6b9918aaeab62310ef5904.zip
Get age from user_profile instead of user_data if present
-rw-r--r--lib/postrunner/UserProfileView.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/postrunner/UserProfileView.rb b/lib/postrunner/UserProfileView.rb
index 4d45d94..988a2bf 100644
--- a/lib/postrunner/UserProfileView.rb
+++ b/lib/postrunner/UserProfileView.rb
@@ -46,16 +46,18 @@ module PostRunner
user_profile = @fit_activity.user_profiles.first
hr_zones = @fit_activity.heart_rate_zones.first
- if user_data.height
+ if user_data && user_data.height
unit = { :metric => 'm', :statute => 'ft' }[@unit_system]
height = user_data.get_as('height', unit)
t.cell('Height:', { :width => '40%' })
t.cell("#{'%.2f' % height} #{unit}", { :width => '60%' })
t.new_row
end
- if user_data.weight
+ if (user_data && user_data.weight) ||
+ (user_profile && user_profile.weight)
unit = { :metric => 'kg', :statute => 'lbs' }[@unit_system]
- weight = user_data.get_as('weight', unit)
+ weight = (user_profile && user_profile.get_as('weight', unit)) ||
+ (user_data && user_data.get_as('weight', unit))
t.row([ 'Weight:', "#{'%.1f' % weight} #{unit}" ])
end
t.row([ 'Gender:', user_data.gender ]) if user_data.gender