3781: Merge branch 'master' into 3781-browser-upload
[arvados.git] / apps / workbench / app / helpers / jobs_helper.rb
1 module JobsHelper
2   def stderr_log_history(job_uuids)
3     results = []
4
5     log_history = Log.where(event_type: 'stderr',
6                             object_uuid: job_uuids).order('id DESC')
7     if !log_history.results.empty?
8       reversed_results = log_history.results.reverse
9       reversed_results.each do |entry|
10         if entry.andand.properties
11           properties = entry.properties
12           text = properties[:text]
13           if text
14             results = results.concat text.split("\n")
15           end
16         end
17       end
18     end
19     return results
20   end
21
22 end