fix(instructeurs/procedures#index): counter not in sync
This commit is contained in:
parent
1d99e21a27
commit
ad4e5a8bc6
2 changed files with 6 additions and 4 deletions
|
@ -12,7 +12,9 @@ module Instructeurs
|
|||
.includes(:defaut_groupe_instructeur)
|
||||
.order(closed_at: :desc, unpublished_at: :desc, published_at: :desc, created_at: :desc)
|
||||
|
||||
dossiers = current_instructeur.dossiers.joins(:groupe_instructeur)
|
||||
dossiers = current_instructeur.dossiers
|
||||
.joins(groupe_instructeur: :procedure)
|
||||
.where(procedures: { hidden_at: nil })
|
||||
dossiers_visibles = dossiers.visible_by_administration
|
||||
@dossiers_count_per_procedure = dossiers_visibles.all_state.group('groupe_instructeurs.procedure_id').reorder(nil).count
|
||||
@dossiers_a_suivre_count_per_procedure = dossiers_visibles.without_followers.en_cours.group('groupe_instructeurs.procedure_id').reorder(nil).count
|
||||
|
|
|
@ -301,18 +301,18 @@ class Dossier < ApplicationRecord
|
|||
scope :interval_brouillon_close_to_expiration, -> do
|
||||
state_brouillon
|
||||
.visible_by_user
|
||||
.where("dossiers.created_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
.where("dossiers.created_at + dossiers.conservation_extension + (procedures.duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
scope :interval_en_construction_close_to_expiration, -> do
|
||||
state_en_construction
|
||||
.visible_by_user_or_administration
|
||||
.where("dossiers.en_construction_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
.where("dossiers.en_construction_at + dossiers.conservation_extension + (procedures.duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
scope :interval_termine_close_to_expiration, -> do
|
||||
state_termine
|
||||
.visible_by_user_or_administration
|
||||
.where(procedures: { procedure_expires_when_termine_enabled: true })
|
||||
.where("dossiers.processed_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
.where("dossiers.processed_at + dossiers.conservation_extension + (procedures.duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
|
||||
scope :brouillon_close_to_expiration, -> do
|
||||
|
|
Loading…
Reference in a new issue