remove useless columns from the db

This commit is contained in:
kara Diaby 2021-03-22 10:02:38 +01:00
parent 8e1569a658
commit 71973de17c
2 changed files with 3 additions and 22 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
@ -57,26 +57,7 @@ class Avis < ApplicationRecord
attr_accessor :emails
attr_accessor :invite_linked_dossiers
def claimant
claimant_id = read_attribute(:claimant_id)
claimant_type = read_attribute(:claimant_type)
if claimant_type == 'Instructeur' || !tmp_expert_migrated
Instructeur.find(claimant_id)
else
Expert.find(claimant_id)
end
end
def claimant=(claimant)
self.claimant_id = claimant.id
if claimant.is_a? Instructeur
self.claimant_type = 'Instructeur'
else
self.claimant_type = 'Expert'
self.tmp_expert_migrated = true
end
end
self.ignored_columns = [:instructeur_id, :tmp_expert_migrated]
def email_to_display
expert&.email

View file

@ -123,7 +123,7 @@ ActiveRecord::Schema.define(version: 2021_03_11_141956) do
t.datetime "revoked_at"
t.bigint "experts_procedure_id"
t.string "claimant_type"
t.boolean "tmp_expert_migrated", default: false
t.boolean "tmp_expert_migrated"
t.index ["claimant_id"], name: "index_avis_on_claimant_id"
t.index ["dossier_id"], name: "index_avis_on_dossier_id"
t.index ["experts_procedure_id"], name: "index_avis_on_experts_procedure_id"