Merge pull request #680 from sgmap/workaround_preview_issue
Dossier: workaround preview bug linked to champs with dossier.id == 0
This commit is contained in:
commit
32e08bea82
1 changed files with 6 additions and 2 deletions
|
@ -121,11 +121,15 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
def ordered_pieces_justificatives
|
||||
|
|
Loading…
Reference in a new issue