refactor(dossier): remove unused scopes

This commit is contained in:
Paul Chavard 2024-08-22 17:31:36 +02:00
parent bb2f590d18
commit 701a28302e
No known key found for this signature in database
2 changed files with 8 additions and 39 deletions

View file

@ -270,26 +270,9 @@ class Dossier < ApplicationRecord
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
scope :without_followers, -> { where.missing(:follows) }
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 :with_annotations, -> {
includes(champs_private: [
:geo_areas,
piece_justificative_file_attachments: :blob,
champs: [piece_justificative_file_attachments: :blob]
])
}
scope :for_api, -> {
with_champs
.with_annotations
.includes(commentaires: { piece_jointe_attachments: :blob },
includes(commentaires: { piece_jointe_attachments: :blob },
justificatif_motivation_attachment: :blob,
attestation: [],
avis: { piece_justificative_file_attachment: :blob },

View file

@ -239,20 +239,6 @@ class Procedure < ApplicationRecord
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 :description, presence: true, allow_blank: false, allow_nil: false
validates :administrateurs, presence: true