refactor(dossier): remove unused scopes
This commit is contained in:
parent
bb2f590d18
commit
701a28302e
2 changed files with 8 additions and 39 deletions
|
@ -270,33 +270,16 @@ class Dossier < ApplicationRecord
|
||||||
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
||||||
scope :without_followers, -> { where.missing(:follows) }
|
scope :without_followers, -> { where.missing(:follows) }
|
||||||
scope :with_followers, -> { left_outer_joins(:follows).where.not(follows: { id: nil }) }
|
scope :with_followers, -> { left_outer_joins(:follows).where.not(follows: { id: nil }) }
|
||||||
scope :with_champs, -> {
|
|
||||||
includes(champs_public: [
|
|
||||||
:geo_areas,
|
|
||||||
piece_justificative_file_attachments: :blob,
|
|
||||||
champs: [piece_justificative_file_attachments: :blob]
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
scope :brouillons_recently_updated, -> { updated_since(2.days.ago).state_brouillon.order_by_updated_at }
|
scope :brouillons_recently_updated, -> { updated_since(2.days.ago).state_brouillon.order_by_updated_at }
|
||||||
scope :with_annotations, -> {
|
|
||||||
includes(champs_private: [
|
|
||||||
:geo_areas,
|
|
||||||
piece_justificative_file_attachments: :blob,
|
|
||||||
champs: [piece_justificative_file_attachments: :blob]
|
|
||||||
])
|
|
||||||
}
|
|
||||||
scope :for_api, -> {
|
scope :for_api, -> {
|
||||||
with_champs
|
includes(commentaires: { piece_jointe_attachments: :blob },
|
||||||
.with_annotations
|
justificatif_motivation_attachment: :blob,
|
||||||
.includes(commentaires: { piece_jointe_attachments: :blob },
|
attestation: [],
|
||||||
justificatif_motivation_attachment: :blob,
|
avis: { piece_justificative_file_attachment: :blob },
|
||||||
attestation: [],
|
traitement: [],
|
||||||
avis: { piece_justificative_file_attachment: :blob },
|
etablissement: [],
|
||||||
traitement: [],
|
individual: [],
|
||||||
etablissement: [],
|
user: [])
|
||||||
individual: [],
|
|
||||||
user: [])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scope :with_notifiable_procedure, -> (opts = { notify_on_closed: false }) do
|
scope :with_notifiable_procedure, -> (opts = { notify_on_closed: false }) do
|
||||||
|
|
|
@ -239,20 +239,6 @@ class Procedure < ApplicationRecord
|
||||||
includes(:draft_revision, :published_revision, administrateurs: :user)
|
includes(:draft_revision, :published_revision, administrateurs: :user)
|
||||||
}
|
}
|
||||||
|
|
||||||
scope :for_download, -> {
|
|
||||||
includes(
|
|
||||||
:groupe_instructeurs,
|
|
||||||
dossiers: {
|
|
||||||
champs_public: [
|
|
||||||
piece_justificative_file_attachments: :blob,
|
|
||||||
champs: [
|
|
||||||
piece_justificative_file_attachments: :blob
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||||
validates :description, presence: true, allow_blank: false, allow_nil: false
|
validates :description, presence: true, allow_blank: false, allow_nil: false
|
||||||
validates :administrateurs, presence: true
|
validates :administrateurs, presence: true
|
||||||
|
|
Loading…
Reference in a new issue