rosa-build/lib/abf_worker/base_observer.rb

20 lines
444 B
Ruby
Raw Normal View History

module AbfWorker
2012-12-11 15:25:25 +00:00
class BaseObserver
2012-12-13 12:30:37 +00:00
COMPLETED = 0
FAILED = 1
PENDING = 2
STARTED = 3
CANCELED = 4
2012-12-11 15:25:25 +00:00
def self.update_results(subject, options)
results = (subject.results || []) + options['results']
sort_results_and_save(subject, results)
end
def self.sort_results_and_save(subject, results)
subject.results = results.sort_by{ |r| r['file_name'] }
subject.save!
end
end
end