remove useless code in models

This commit is contained in:
kara Diaby 2021-03-22 10:05:04 +01:00
parent fe7fb882c8
commit 2930de1015
3 changed files with 3 additions and 6 deletions

View file

@ -9,7 +9,7 @@
# email :string
# introduction :text
# revoked_at :datetime
# tmp_expert_migrated :boolean default(FALSE)
# tmp_expert_migrated :boolean default(FALSE)
# created_at :datetime not null
# updated_at :datetime not null
# claimant_id :integer not null
@ -21,9 +21,8 @@ class Avis < ApplicationRecord
include EmailSanitizableConcern
belongs_to :dossier, inverse_of: :avis, touch: true, optional: false
belongs_to :instructeur, optional: true
belongs_to :experts_procedure, optional: false
belongs_to :claimant, class_name: 'Instructeur', optional: false
belongs_to :claimant, polymorphic: true, optional: false
has_one_attached :piece_justificative_file
has_one_attached :introduction_file

View file

@ -23,8 +23,6 @@ class Instructeur < ApplicationRecord
has_many :previous_follows, -> { inactive }, class_name: 'Follow', inverse_of: :instructeur
has_many :followed_dossiers, through: :follows, source: :dossier
has_many :previously_followed_dossiers, -> { distinct }, through: :previous_follows, source: :dossier
has_many :avis
has_many :dossiers_from_avis, through: :avis, source: :dossier
has_many :trusted_device_tokens, dependent: :destroy
has_one :user, dependent: :nullify

View file

@ -21,7 +21,7 @@ class DossierSearchService
end
def self.dossiers_by_id(id, instructeur)
(instructeur.dossiers.where(id: id) + instructeur.dossiers_from_avis.where(id: id)).uniq
instructeur.dossiers.where(id: id).uniq
end
def self.id_compatible?(number)