summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/postrunner/FFS_Activity.rb4
-rw-r--r--lib/postrunner/FitFileStore.rb17
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/postrunner/FFS_Activity.rb b/lib/postrunner/FFS_Activity.rb
index 46ea2bf..138912f 100644
--- a/lib/postrunner/FFS_Activity.rb
+++ b/lib/postrunner/FFS_Activity.rb
@@ -288,7 +288,9 @@ module PostRunner
end
end
- private
+ def purge_fit_file
+ @fit_activity = nil
+ end
end
diff --git a/lib/postrunner/FitFileStore.rb b/lib/postrunner/FitFileStore.rb
index ab6fefc..d5dba15 100644
--- a/lib/postrunner/FitFileStore.rb
+++ b/lib/postrunner/FitFileStore.rb
@@ -209,7 +209,17 @@ module PostRunner
@store['devices'].each do |id, device|
list += device.activities
end
- list.sort
+ # Sort the activites by timestamps (oldest to newest). 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
+ end
+
+ list
end
# Read in all Monitoring_B FIT files that overlap with the given interval.
@@ -305,11 +315,10 @@ module PostRunner
def check
records = @store['records']
records.delete_all_records
- activities.sort do |a1, a2|
- a1.timestamp <=> a2.timestamp
- end.each do |a|
+ activities.each do |a|
a.check
records.scan_activity_for_records(a)
+ a.purge_fit_file
end
records.generate_html_reports
generate_html_index_pages