chore(dossier): remove legacy update attributes
This commit is contained in:
parent
8431771a61
commit
1bca3c123b
27 changed files with 50 additions and 245 deletions
|
@ -2,9 +2,6 @@ class Champ < ApplicationRecord
|
|||
include ChampConditionalConcern
|
||||
include ChampsValidateConcern
|
||||
|
||||
# TODO: remove after one deploy
|
||||
attr_writer :with_public_id
|
||||
|
||||
belongs_to :dossier, inverse_of: false, touch: true, optional: false
|
||||
belongs_to :type_de_champ, inverse_of: :champ, optional: false
|
||||
belongs_to :parent, class_name: 'Champ', optional: true
|
||||
|
@ -295,10 +292,6 @@ class Champ < ApplicationRecord
|
|||
self.value = value.delete("\u0000")
|
||||
end
|
||||
|
||||
def self.update_by_stable_id?
|
||||
Flipper.enabled?(:champ_update_by_stable_id, Current.user)
|
||||
end
|
||||
|
||||
class NotImplemented < ::StandardError
|
||||
def initialize(method)
|
||||
super(":#{method} not implemented")
|
||||
|
|
|
@ -65,13 +65,6 @@ module DossierChampsConcern
|
|||
end
|
||||
|
||||
def update_champs_attributes(attributes, scope)
|
||||
# TODO: remove after one deploy
|
||||
if attributes.present? && attributes.values.filter { _1.key?(:with_public_id) }.empty?
|
||||
assign_attributes("champs_#{scope}_all_attributes".to_sym => attributes)
|
||||
@champs_by_public_id = nil
|
||||
return
|
||||
end
|
||||
|
||||
champs_attributes = attributes.to_h.map do |public_id, attributes|
|
||||
champ_attributes_by_public_id(public_id, attributes, scope)
|
||||
end
|
||||
|
|
|
@ -49,8 +49,6 @@ class Dossier < ApplicationRecord
|
|||
has_many :champs_to_destroy, -> { order(:parent_id) }, class_name: 'Champ', inverse_of: false, dependent: :destroy
|
||||
has_many :champs_public, -> { root.public_only }, class_name: 'Champ', inverse_of: false
|
||||
has_many :champs_private, -> { root.private_only }, class_name: 'Champ', inverse_of: false
|
||||
has_many :champs_public_all, -> { public_only }, class_name: 'Champ', inverse_of: false
|
||||
has_many :champs_private_all, -> { private_only }, class_name: 'Champ', inverse_of: false
|
||||
has_many :prefilled_champs_public, -> { root.public_only.prefilled }, class_name: 'Champ', inverse_of: false
|
||||
|
||||
has_many :commentaires, inverse_of: :dossier, dependent: :destroy
|
||||
|
@ -145,8 +143,6 @@ class Dossier < ApplicationRecord
|
|||
accepts_nested_attributes_for :champs
|
||||
accepts_nested_attributes_for :champs_public
|
||||
accepts_nested_attributes_for :champs_private
|
||||
accepts_nested_attributes_for :champs_public_all
|
||||
accepts_nested_attributes_for :champs_private_all
|
||||
accepts_nested_attributes_for :individual
|
||||
|
||||
include AASM
|
||||
|
|
|
@ -93,8 +93,6 @@ class DossierPreloader
|
|||
champs_public, champs_private = champs.partition(&:public?)
|
||||
|
||||
dossier.association(:champs).target = []
|
||||
dossier.association(:champs_public_all).target = []
|
||||
dossier.association(:champs_private_all).target = []
|
||||
load_champs(dossier, :champs_public, champs_public, dossier, children_by_parent)
|
||||
load_champs(dossier, :champs_private, champs_private, dossier, children_by_parent)
|
||||
|
||||
|
@ -122,12 +120,6 @@ class DossierPreloader
|
|||
|
||||
dossier.association(:champs).target += champs
|
||||
|
||||
if champs.first.public?
|
||||
dossier.association(:champs_public_all).target += champs
|
||||
else
|
||||
dossier.association(:champs_private_all).target += champs
|
||||
end
|
||||
|
||||
parent.association(name).target = champs
|
||||
.filter { positions[dossier.revision_id][_1.type_de_champ_id].present? }
|
||||
.sort_by { [_1.row_id, positions[dossier.revision_id][_1.type_de_champ_id]] }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue