feat(dossier): pending resolution state

This commit is contained in:
Colin Darie 2023-02-28 15:11:48 +01:00
parent 2c79ca94f5
commit d73b96ea40
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
3 changed files with 37 additions and 0 deletions

View file

@ -3,5 +3,12 @@ module DossierResolvableConcern
included do
has_many :resolutions, class_name: 'DossierResolution', dependent: :destroy
def pending_resolution?
# We don't want to show any alert if user is not allowed to modify the dossier
return false unless en_construction?
resolutions.pending.exists?
end
end
end

View file

@ -12,4 +12,6 @@
class DossierResolution < ApplicationRecord
belongs_to :dossier
belongs_to :commentaire
scope :pending, -> { where(resolved_at: nil) }
end