Skip to content

Commit 4b5cd47

Browse files
tchakclaude
andcommitted
Tech: rename champs and types de champ accessors
Rename projection accessors to describe what they return: - ProcedureRevision#types_de_champ_public -> root_types_de_champ_public - ProcedureRevision#types_de_champ_private -> root_types_de_champ_private - Dossier#project_champs -> champs - Dossier#project_champs_public -> root_champs_public - Dossier#project_champs_private -> root_champs_private - Dossier#project_champs_public_all -> flat_champs_public - Dossier#project_champs_private_all -> flat_champs_private The Dossier delegate to revision follows the ProcedureRevision rename. Names that only share the spelling are left untouched: the procedure factory transients, ProcedureSerializer JSON keys, validation scope symbols and i18n keys. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 988dadc commit 4b5cd47

202 files changed

Lines changed: 839 additions & 839 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/components/conditions/routing_rules_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def initialize(groupe_instructeur:)
88
@condition = groupe_instructeur.routing_rule || empty_operator(empty, empty)
99
@procedure = groupe_instructeur.procedure
1010
@procedure_id = @procedure.id
11-
@source_tdcs = @procedure.active_revision.types_de_champ_public
11+
@source_tdcs = @procedure.active_revision.root_types_de_champ_public
1212
@champ_value_in_condition = @procedure.champ_value_in_condition?
1313
end
1414

app/components/types_de_champ_editor/estimated_fill_duration_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def render?
1717
end
1818

1919
def show?
20-
!annotations? && @revision.types_de_champ_public.present?
20+
!annotations? && @revision.root_types_de_champ_public.present?
2121
end
2222

2323
def estimated_fill_duration_minutes

app/components/viewable_champ/header_sections_summary_component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ def initialize(dossier:, is_private:)
88
@is_private = is_private
99

1010
@header_sections = if is_private
11-
dossier.revision.types_de_champ_private
11+
dossier.revision.root_types_de_champ_private
1212
else
13-
dossier.revision.types_de_champ_public
13+
dossier.revision.root_types_de_champ_public
1414
end.filter(&:header_section?)
1515
end
1616

app/controllers/instructeurs/dossiers_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def update_annotations
380380

381381
respond_to do |format|
382382
format.turbo_stream do
383-
@to_show, @to_hide, @to_update = champs_to_turbo_update(champs_attributes_params(:private), dossier.project_champs_private_all)
383+
@to_show, @to_hide, @to_update = champs_to_turbo_update(champs_attributes_params(:private), dossier.flat_champs_private)
384384
end
385385
end
386386
end
@@ -398,7 +398,7 @@ def annotation
398398

399399
respond_to do |format|
400400
format.turbo_stream do
401-
@to_show, @to_hide, @to_update = champ_to_turbo_update(annotation, dossier.project_champs_private_all)
401+
@to_show, @to_hide, @to_update = champ_to_turbo_update(annotation, dossier.flat_champs_private)
402402

403403
render :update_annotations, layout: false
404404
end

app/controllers/instructeurs/edit_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def update
2121

2222
respond_to do |format|
2323
format.turbo_stream do
24-
@to_show, @to_hide, @to_update = champs_to_turbo_update(champs_attributes_params(:public), dossier.project_champs_public_all)
24+
@to_show, @to_hide, @to_update = champs_to_turbo_update(champs_attributes_params(:public), dossier.flat_champs_public)
2525
render layout: false
2626
end
2727
end
@@ -59,7 +59,7 @@ def champ
5959

6060
respond_to do |format|
6161
format.turbo_stream do
62-
@to_show, @to_hide, @to_update = champ_to_turbo_update(champ, dossier.project_champs_public_all)
62+
@to_show, @to_hide, @to_update = champ_to_turbo_update(champ, dossier.flat_champs_public)
6363
render :update, layout: false
6464
end
6565
end

app/controllers/prefill_type_de_champs_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def retrieve_procedure
1414
end
1515

1616
def set_prefill_type_de_champ
17-
type_de_champ = @procedure.active_revision.types_de_champ_public.filter(&:fillable?).find { _1.stable_id == params[:id].to_i }
17+
type_de_champ = @procedure.active_revision.root_types_de_champ_public.filter(&:fillable?).find { _1.stable_id == params[:id].to_i }
1818
raise ActiveRecord::RecordNotFound if type_de_champ.blank?
1919
@type_de_champ = TypesDeChamp::PrefillTypeDeChamp.build(type_de_champ, @procedure.active_revision)
2020
end

app/controllers/users/dossiers_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def update
337337

338338
respond_to do |format|
339339
format.turbo_stream do
340-
@to_show, @to_hide, @to_update = champs_to_turbo_update(champs_attributes_params(:public), dossier.project_champs_public_all)
340+
@to_show, @to_hide, @to_update = champs_to_turbo_update(champs_attributes_params(:public), dossier.flat_champs_public)
341341
render :update, layout: false
342342
end
343343
end
@@ -357,7 +357,7 @@ def champ
357357
champ.validate(:champ_value) if champ.done?
358358
respond_to do |format|
359359
format.turbo_stream do
360-
@to_show, @to_hide, @to_update = champ_to_turbo_update(champ, dossier.project_champs_public_all)
360+
@to_show, @to_hide, @to_update = champ_to_turbo_update(champ, dossier.flat_champs_public)
361361

362362
render :update, layout: false
363363
end

app/dashboards/dossier_dashboard.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DossierDashboard < Administrate::BaseDashboard
2424
en_construction_at: Field::DateTime,
2525
en_instruction_at: Field::DateTime,
2626
processed_at: Field::DateTime,
27-
project_champs_public: ChampCollectionField,
27+
root_champs_public: ChampCollectionField,
2828
groupe_instructeur: Field::BelongsTo,
2929
}.freeze
3030

@@ -48,7 +48,7 @@ class DossierDashboard < Administrate::BaseDashboard
4848
:state,
4949
:procedure,
5050
:groupe_instructeur,
51-
:project_champs_public,
51+
:root_champs_public,
5252
:created_at,
5353
:updated_at,
5454
:hidden_by_user_at,

app/graphql/types/dossier_type.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,17 @@ def avis(id: nil)
168168

169169
def champs(id: nil)
170170
if id.present?
171-
find_record_by_typed_id(object.project_champs_public, id, attribute: :stable_id)
171+
find_record_by_typed_id(object.root_champs_public, id, attribute: :stable_id)
172172
else
173-
object.project_champs_public.filter(&:visible?)
173+
object.root_champs_public.filter(&:visible?)
174174
end
175175
end
176176

177177
def annotations(id: nil)
178178
if id.present?
179-
find_record_by_typed_id(object.project_champs_private, id, attribute: :stable_id)
179+
find_record_by_typed_id(object.root_champs_private, id, attribute: :stable_id)
180180
else
181-
object.project_champs_private.filter(&:visible?)
181+
object.root_champs_private.filter(&:visible?)
182182
end
183183
end
184184

app/models/champs/referentiel_champ.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def prefillable_stable_ids
5757
def prefillable_champs
5858
elligible_stable_ids = prefillable_stable_ids
5959
if public?
60-
dossier.project_champs_public
60+
dossier.root_champs_public
6161
else
62-
dossier.project_champs_private
62+
dossier.root_champs_private
6363
end.filter do |champ|
6464
if champ.repetition?
6565
dossier.revision.children_of(champ.type_de_champ).any? { _1.stable_id.in?(elligible_stable_ids) }

0 commit comments

Comments
 (0)