add hidden_by_instructeur scope
This commit is contained in:
parent
f239d46a45
commit
22ac853815
3 changed files with 4 additions and 2 deletions
|
@ -16,7 +16,7 @@ module Instructeurs
|
|||
@dossiers_count_per_procedure = dossiers.all_state.group('groupe_instructeurs.procedure_id').reorder(nil).count
|
||||
@dossiers_a_suivre_count_per_procedure = dossiers.without_followers.en_cours.group('groupe_instructeurs.procedure_id').reorder(nil).count
|
||||
@dossiers_archived_count_per_procedure = dossiers.archived.group('groupe_instructeurs.procedure_id').count
|
||||
@dossiers_termines_count_per_procedure = dossiers.termine.group('groupe_instructeurs.procedure_id').reorder(nil).count
|
||||
@dossiers_termines_count_per_procedure = dossiers.termine.not_hidden_by_instructeur.group('groupe_instructeurs.procedure_id').reorder(nil).count
|
||||
@dossiers_expirant_count_per_procedure = dossiers.termine_or_en_construction_close_to_expiration.group('groupe_instructeurs.procedure_id').count
|
||||
groupe_ids = current_instructeur.groupe_instructeurs.pluck(:id)
|
||||
|
||||
|
@ -69,7 +69,7 @@ module Instructeurs
|
|||
|
||||
@followed_dossiers_id = @followed_dossiers.pluck(:id)
|
||||
|
||||
@termines_dossiers = dossiers_visibles.termine
|
||||
@termines_dossiers = dossiers_visibles.termine.not_hidden_by_instructeur
|
||||
@all_state_dossiers = dossiers_visibles.all_state
|
||||
@archived_dossiers = dossiers_visibles.archived
|
||||
@expirant_dossiers = dossiers_visibles.termine_or_en_construction_close_to_expiration
|
||||
|
|
|
@ -207,6 +207,7 @@ class Dossier < ApplicationRecord
|
|||
scope :archived, -> { where(archived: true) }
|
||||
scope :not_archived, -> { where(archived: false) }
|
||||
scope :not_hidden_by_user, -> { where(hidden_by_user_at: nil) }
|
||||
scope :not_hidden_by_instructeur, -> { where(hidden_by_instructeur_at: nil) }
|
||||
|
||||
scope :order_by_updated_at, -> (order = :desc) { order(updated_at: order) }
|
||||
scope :order_by_created_at, -> (order = :asc) { order(depose_at: order, created_at: order, id: order) }
|
||||
|
|
|
@ -256,6 +256,7 @@ class Instructeur < ApplicationRecord
|
|||
ON follows.dossier_id = dossiers.id
|
||||
AND follows.unfollowed_at IS NULL
|
||||
WHERE "dossiers"."hidden_at" IS NULL
|
||||
AND "dossiers"."hidden_by_instructeur_at" IS NULL
|
||||
AND "dossiers"."state" != 'brouillon'
|
||||
AND "dossiers"."groupe_instructeur_id" in (:groupe_instructeur_ids)
|
||||
EOF
|
||||
|
|
Loading…
Add table
Reference in a new issue