diff options
author | Chris Schlaeger <chris@linux.com> | 2017-09-03 22:15:18 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2017-09-03 22:15:18 +0200 |
commit | 7c4e615a28a263477d4dd35e59c6670ba9342045 (patch) | |
tree | 222ad83a0aa7440afd91110a95b278d5c7050d17 | |
parent | de173fff12b2b9c20acd1a1dd1154eebf91e676c (diff) | |
download | postrunner-7c4e615a28a263477d4dd35e59c6670ba9342045.zip |
Fix sorting sequence in activity list views
-rw-r--r-- | lib/postrunner/FitFileStore.rb | 8 | ||||
-rw-r--r-- | lib/postrunner/HRV_Analyzer.rb | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/postrunner/FitFileStore.rb b/lib/postrunner/FitFileStore.rb index d5dba15..2376f71 100644 --- a/lib/postrunner/FitFileStore.rb +++ b/lib/postrunner/FitFileStore.rb @@ -176,7 +176,7 @@ module PostRunner def change_unit_system # If we have changed the unit system we need to re-generate all HTML # reports. - activities.each do |activity| + activities.reverse.each do |activity| activity.generate_html_report end @store['records'].generate_html_reports @@ -209,14 +209,14 @@ module PostRunner @store['devices'].each do |id, device| list += device.activities end - # Sort the activites by timestamps (oldest to newest). As the list is + # Sort the activites by timestamps (newest to oldest). As the list is # composed from multiple devices, there is a small chance of identical # timestamps. To guarantee a stable list, we use the long UID of the # device in cases of identical timestamps. list.sort! do |a1, a2| a1.timestamp == a2.timestamp ? a1.device.long_uid <=> a2.device.long_uid : - a1.timestamp <=> a2.timestamp + a2.timestamp <=> a1.timestamp end list @@ -315,7 +315,7 @@ module PostRunner def check records = @store['records'] records.delete_all_records - activities.each do |a| + activities.reverse.each do |a| a.check records.scan_activity_for_records(a) a.purge_fit_file diff --git a/lib/postrunner/HRV_Analyzer.rb b/lib/postrunner/HRV_Analyzer.rb index c240046..77162bd 100644 --- a/lib/postrunner/HRV_Analyzer.rb +++ b/lib/postrunner/HRV_Analyzer.rb @@ -21,8 +21,12 @@ module PostRunner attr_reader :rr_intervals, :timestamps, :errors - # Typical values for healthy, adult humans are between 2.94 and 4.32. We - # use a slighly broader interval. + # According to Nunan et. al. 2010 + # (http://www.qeeg.co.uk/HRV/NUNAN-2010-A%20Quantitative%20Systematic%20Review%20of%20Normal%20Values%20for.pdf) + # rMSSD (ms) are expected to be in the rage of 19 to 75 in healthy, adult + # humans. Typical ln(rMSSD) (ms) values for healthy, adult humans are + # between 2.94 and 4.32. We use a slighly broader interval. We'll add a + # bit of padding for our limits here. LN_RMSSD_MIN = 2.9 LN_RMSSD_MAX = 4.4 @@ -45,11 +49,7 @@ module PostRunner @timestamps[-1] end - # Compute the root mean square of successive differences. According to - # Nunan et. al. 2010 - # (http://www.qeeg.co.uk/HRV/NUNAN-2010-A%20Quantitative%20Systematic%20Review%20of%20Normal%20Values%20for.pdf) - # rMSSD (ms) are expected to be in the rage of 19 to 75 in healthy, adult - # humans. + # Compute the root mean square of successive differences. # @param start_time [Float] Determines at what time mark (in seconds) the # computation should start. # @param duration [Float] The duration of the total inteval in seconds to |