Skip to content

Commit

Permalink
attempt to identify code that prevent modifications of annotations in…
Browse files Browse the repository at this point in the history
… some dossiers
  • Loading branch information
maatinito committed Jan 29, 2024
1 parent 98703b3 commit ee09476
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/instructeurs/dossiers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,14 @@ def remove_changes_forbidden_by_visa
# auto-save send small sets of fields to update so for speed, we look for brothers containing visa
visa_type = TypeDeChamp.type_champs.fetch(:visa)
champs = Champ.joins(type_de_champ: :revision_types_de_champ).select(:dossier_id, :row_id, :position)
params[:dossier][:champs_private_attributes]&.reject! do |_k, v|
params[:dossier][:champs_private_attributes]&.each_pair do |_k, v|
champ = champs.find(v[:id])
# look for position of last checked visa in same dossier, row
visa = champs.private_only
.where(row_id: champ.row_id, dossier: champ.dossier_id, type_de_champ: { type_champ: visa_type })
.where.not(value: "")
.order(position: :desc).first
visa.present? && champ[:position] < visa[:position]
Rails.logger.info("visa?=#{visa.present?} champ_position=#{champ[:position]} visa_position=#{visa&.[](:position)}")
end
champs_private_params
end
Expand Down

0 comments on commit ee09476

Please sign in to comment.