highlight demande tab when groupe instructeur updated

This commit is contained in:
Christophe Robillard 2020-02-26 22:43:59 +01:00
parent 924702699f
commit 50007b2aac
2 changed files with 9 additions and 1 deletions

View file

@ -98,7 +98,8 @@ class Instructeur < ApplicationRecord
.find_by(instructeur: self, dossier: dossier)
if follow.present?
demande = follow.dossier.champs.updated_since?(follow.demande_seen_at).any?
demande = follow.dossier.champs.updated_since?(follow.demande_seen_at).any? || follow.dossier.groupe_instructeur_updated_at&.>(follow.demande_seen_at)
demande = false if demande.nil?
annotations_privees = follow.dossier.champs_private.updated_since?(follow.annotations_privees_seen_at).any?

View file

@ -223,6 +223,13 @@ describe Instructeur, type: :model do
it { is_expected.to match({ demande: true, annotations_privees: false, avis: false, messagerie: false }) }
end
context 'when there is a modification on groupe instructeur' do
let(:groupe_instructeur) { create(:groupe_instructeur, instructeurs: [instructeur], procedure: dossier.procedure) }
before { dossier.assign_to_groupe_instructeur(groupe_instructeur) }
it { is_expected.to match({ demande: true, annotations_privees: false, avis: false, messagerie: false }) }
end
context 'when there is a modification on private champs' do
before { dossier.champs_private.first.update_attribute('value', 'toto') }