diff options
-rw-r--r-- | lib/postrunner/ActivitiesDB.rb | 4 | ||||
-rw-r--r-- | lib/postrunner/Activity.rb | 8 | ||||
-rw-r--r-- | lib/postrunner/Main.rb | 7 |
3 files changed, 13 insertions, 6 deletions
diff --git a/lib/postrunner/ActivitiesDB.rb b/lib/postrunner/ActivitiesDB.rb index 87931cd..13052dd 100644 --- a/lib/postrunner/ActivitiesDB.rb +++ b/lib/postrunner/ActivitiesDB.rb @@ -84,6 +84,10 @@ module PostRunner Log.error $! return false end + unless fit_activity + Log.error "#{fit_file} does not contain any activity records" + return false + end begin FileUtils.cp(fit_file, @fit_dir) diff --git a/lib/postrunner/Activity.rb b/lib/postrunner/Activity.rb index dbb19b1..1ca96b1 100644 --- a/lib/postrunner/Activity.rb +++ b/lib/postrunner/Activity.rb @@ -232,10 +232,16 @@ module PostRunner def load_fit_file(filter = nil) fit_file = File.join(@db.fit_dir, @fit_file) begin - return Fit4Ruby.read(fit_file, filter) + fit_activity = Fit4Ruby.read(fit_file, filter) rescue Fit4Ruby::Error Log.fatal $! end + + unless fit_activity + Log.fatal "#{fit_file} does not contain any activity records" + end + + fit_activity end end diff --git a/lib/postrunner/Main.rb b/lib/postrunner/Main.rb index f368028..73f9c4a 100644 --- a/lib/postrunner/Main.rb +++ b/lib/postrunner/Main.rb @@ -190,6 +190,7 @@ EOT when 'check' if args.empty? @activities.check + @activities.generate_all_html_reports else process_files_or_activities(args, :check) end @@ -325,11 +326,7 @@ EOT end def read_fit_file(fit_file) - begin - return Fit4Ruby::read(fit_file, @filter) - rescue StandardError - Log.error("Cannot read FIT file '#{fit_file}': #{$!}") - end + return Fit4Ruby::read(fit_file, @filter) end def change_unit_system(args) |