demarches-normaliennes/app/models/concerns/blob_titre_identite_watermark_concern.rb

22 lines
407 B
Ruby
Raw Normal View History

2020-11-17 16:34:24 +01:00
module BlobTitreIdentiteWatermarkConcern
def watermark_pending?
watermark_required? && !watermark_done?
end
def watermark_done?
watermarked_at.present?
2020-11-17 16:34:24 +01:00
end
def watermark_later
if watermark_pending?
2020-11-17 16:34:24 +01:00
TitreIdentiteWatermarkJob.perform_later(self)
end
end
private
def watermark_required?
attachments.any? { _1.record.class == Champs::TitreIdentiteChamp }
end
2020-11-17 16:34:24 +01:00
end