diff options
-rw-r--r-- | lib/postrunner/UserProfileView.rb | 8 |
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 |