Sha256: be92735a28a9078b929c576da7937e4ea4c811d9d856ac084f24280c86995f71
Contents?: true
Size: 692 Bytes
Versions: 9
Compression:
Stored size: 692 Bytes
Contents
module JobNotifier class Job < ActiveRecord::Base extend Enumerize STATUSES = [:pending, :finished, :failed] enumerize :status, in: STATUSES, default: :pending def self.update_feedback(job_id, data, status) job = JobNotifier::Job.find_by(job_id: job_id) return unless job job.update_columns(result: data.to_s, status: status, notified: false) end def self.unnotified_by_identifier(encoded_identifier) JobNotifier::Job.where(identifier: encoded_identifier).where(notified: false) end def self.notify_by_identifier(encoded_identifier) unnotified_by_identifier(encoded_identifier).update_all(notified: true) end end end
Version data entries
9 entries across 9 versions & 1 rubygems