diff options
author | Chris Schlaeger <chris@linux.com> | 2018-03-18 21:54:14 +0100 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2018-03-18 21:54:14 +0100 |
commit | 53f4786b1701491eda32ece7ce615f19d3ab1889 (patch) | |
tree | dde195117fcd612bfb559ba6d656a53ddf4fefde | |
parent | b24b1a73baa7ef706a259ffcab926332e8e69387 (diff) | |
download | postrunner-53f4786b1701491eda32ece7ce615f19d3ab1889.zip |
Fix: Fix broken line charts when smart recording was used
-rw-r--r-- | lib/postrunner/ActivitySummary.rb | 4 | ||||
-rw-r--r-- | lib/postrunner/ChartView.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/postrunner/ActivitySummary.rb b/lib/postrunner/ActivitySummary.rb index 3d7277c..b17da0a 100644 --- a/lib/postrunner/ActivitySummary.rb +++ b/lib/postrunner/ActivitySummary.rb @@ -407,10 +407,10 @@ module PostRunner prev_timestamp = nil @activity.fit_activity.records.each do |r| # We need a valid timestmap and a valid previous timestamp. If they - # are more than 5 seconds appart we discard the values as there was + # are more than 10 seconds appart we discard the values as there was # likely a pause in the activity. if prev_timestamp && r.timestamp && r.heart_rate && - r.timestamp - prev_timestamp <= 5 + r.timestamp - prev_timestamp <= 10 # Compute the heart rate as fraction of the heart rate reserve hr_r = (r.heart_rate - rest_hr).to_f / (max_hr - rest_hr) diff --git a/lib/postrunner/ChartView.rb b/lib/postrunner/ChartView.rb index f3dad86..9274d9e 100644 --- a/lib/postrunner/ChartView.rb +++ b/lib/postrunner/ChartView.rb @@ -290,10 +290,10 @@ EOT last_value = nil last_timestamp = nil @activity.fit_activity.records.each do |r| - if last_timestamp && (r.timestamp - last_timestamp) > 5.0 + if last_timestamp && (r.timestamp - last_timestamp) > 10.0 # We have a gap in the values that is longer than 5 seconds. We'll # finish the line and start a new one later. - data_set << [ (r.timestamp - start_time + 1).to_i * 1000, nil ] + data_set << [ (last_timestamp - start_time + 1).to_i * 1000, nil ] end if (value = r.get_as(chart[:id], chart[:unit] || '')) if chart[:id] == 'pace' @@ -310,7 +310,7 @@ EOT min_value = value if (min_value.nil? || min_value > value) end end - unless last_value.nil? && value.nil? + if value data_set << [ (r.timestamp - start_time).to_i * 1000, value ] end last_value = value |