[#2675] Make dossiers_id_with_notifications self-contained
This commit is contained in:
parent
7466557b1f
commit
dfdcfc62e2
1 changed files with 4 additions and 2 deletions
|
@ -126,7 +126,7 @@ class Gestionnaire < ApplicationRecord
|
||||||
procedure.dossiers.not_archived
|
procedure.dossiers.not_archived
|
||||||
else
|
else
|
||||||
procedure.dossiers.en_cours
|
procedure.dossiers.en_cours
|
||||||
end.followed_by(self)
|
end
|
||||||
|
|
||||||
dossiers_id_with_notifications(dossiers)
|
dossiers_id_with_notifications(dossiers)
|
||||||
end
|
end
|
||||||
|
@ -139,7 +139,7 @@ class Gestionnaire < ApplicationRecord
|
||||||
Dossier.not_archived
|
Dossier.not_archived
|
||||||
else
|
else
|
||||||
Dossier.en_cours
|
Dossier.en_cours
|
||||||
end.followed_by(self)
|
end
|
||||||
|
|
||||||
Dossier.where(id: dossiers_id_with_notifications(dossiers)).group(:procedure_id).count
|
Dossier.where(id: dossiers_id_with_notifications(dossiers)).group(:procedure_id).count
|
||||||
end
|
end
|
||||||
|
@ -168,6 +168,8 @@ class Gestionnaire < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossiers_id_with_notifications(dossiers)
|
def dossiers_id_with_notifications(dossiers)
|
||||||
|
dossiers = dossiers.followed_by(self)
|
||||||
|
|
||||||
updated_demandes = dossiers
|
updated_demandes = dossiers
|
||||||
.joins(:champs)
|
.joins(:champs)
|
||||||
.where('champs.updated_at > follows.demande_seen_at')
|
.where('champs.updated_at > follows.demande_seen_at')
|
||||||
|
|
Loading…
Reference in a new issue