Merge pull request #2150 from betagouv/frederic/purge_old_preview_code
We can use the shorter syntax for ordered_champs(_private)
This commit is contained in:
commit
faf08203df
2 changed files with 3 additions and 6 deletions
|
@ -10,6 +10,7 @@ class Champ < ApplicationRecord
|
||||||
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
|
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
|
||||||
scope :public_only, -> { where(private: false) }
|
scope :public_only, -> { where(private: false) }
|
||||||
scope :private_only, -> { where(private: true) }
|
scope :private_only, -> { where(private: true) }
|
||||||
|
scope :ordered, -> { includes(:type_de_champ).order('types_de_champ.order_place') }
|
||||||
|
|
||||||
def public?
|
def public?
|
||||||
!private?
|
!private?
|
||||||
|
|
|
@ -104,15 +104,11 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def ordered_champs
|
def ordered_champs
|
||||||
# TODO: use the line below when the procedure preview does not leak champ with dossier_id == 0
|
champs.ordered
|
||||||
# champs.joins(:type_de_champ).order('types_de_champ.order_place')
|
|
||||||
champs.joins(', types_de_champ').where("champs.type_de_champ_id = types_de_champ.id AND types_de_champ.procedure_id = #{procedure.id}").order('order_place')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def ordered_champs_private
|
def ordered_champs_private
|
||||||
# TODO: use the line below when the procedure preview does not leak champ with dossier_id == 0
|
champs_private.ordered
|
||||||
# champs_private.includes(:type_de_champ).order('types_de_champ.order_place')
|
|
||||||
champs_private.joins(', types_de_champ').where("champs.type_de_champ_id = types_de_champ.id AND types_de_champ.procedure_id = #{procedure.id}").order('order_place')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def ordered_pieces_justificatives
|
def ordered_pieces_justificatives
|
||||||
|
|
Loading…
Add table
Reference in a new issue