summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2016-01-19 16:44:25 +0100
committerChris Schlaeger <chris@linux.com>2016-01-19 16:44:25 +0100
commit034fd536886e2cac72e07ce6039ab98ebd4c859d (patch)
treea42ac7e4589670d935510bd3f0766524ead6dc00
parent7404a9c672f20270dd8ca303dd65bbd241a27b52 (diff)
downloadpostrunner-034fd536886e2cac72e07ce6039ab98ebd4c859d.zip
FIX: Update HTML activity index pages after FIT file import
-rw-r--r--lib/postrunner/FitFileStore.rb34
1 files changed, 19 insertions, 15 deletions
diff --git a/lib/postrunner/FitFileStore.rb b/lib/postrunner/FitFileStore.rb
index 5f2d0a6..0c4ff2b 100644
--- a/lib/postrunner/FitFileStore.rb
+++ b/lib/postrunner/FitFileStore.rb
@@ -93,31 +93,35 @@ module PostRunner
# Make sure the device that created the FIT file is properly registered.
device = register_device(long_uid)
# Store the FIT entity with the device.
- activity = device.add_fit_file(fit_file_name, fit_entity, overwrite)
+ entity = device.add_fit_file(fit_file_name, fit_entity, overwrite)
- # The activity might be already stored or invalid. In that case we
+ # The FIT file might be already stored or invalid. In that case we
# abort this method.
- return nil unless activity
+ return nil unless entity
- @store['records'].scan_activity_for_records(activity)
+ if fit_entity.is_a?(Fit4Ruby::Activity)
+ @store['records'].scan_activity_for_records(entity)
- # Generate HTML file for this activity.
- activity.generate_html_report
+ # Generate HTML file for this activity.
+ entity.generate_html_report
- # The HTML activity views contain links to their predecessors and
- # successors. After inserting a new activity, we need to re-generate
- # these views as well.
- if (pred = predecessor(activity))
- pred.generate_html_report
- end
- if (succ = successor(activity))
- succ.generate_html_report
+ # The HTML activity views contain links to their predecessors and
+ # successors. After inserting a new activity, we need to re-generate
+ # these views as well.
+ if (pred = predecessor(entity))
+ pred.generate_html_report
+ end
+ if (succ = successor(entity))
+ succ.generate_html_report
+ end
+ # And update the index pages
+ generate_html_index_pages
end
Log.info "#{File.basename(fit_file_name)} " +
'has been successfully added to archive'
- activity
+ entity
end
# Delete an activity from the database. It will only delete the entry in