Dossier: workaround preview bug linked to champs with dossier.id == 0
This commit is contained in:
parent
0118c43d95
commit
5737ebd090
1 changed files with 6 additions and 2 deletions
|
@ -121,11 +121,15 @@ class Dossier < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def ordered_champs
|
def ordered_champs
|
||||||
champs.includes(:type_de_champ).order('types_de_champ.order_place')
|
# TODO: use the line below when the procedure preview does not leak champ with dossier_id == 0
|
||||||
|
# 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
|
||||||
champs_private.includes(:type_de_champ).order('types_de_champ.order_place')
|
# TODO: use the line below when the procedure preview does not leak champ with dossier_id == 0
|
||||||
|
# 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