Merge pull request #1947 from tchak/fix-procedure-controller-test

Fix test with ordering failures
This commit is contained in:
Paul Chavard 2018-05-22 17:02:18 +02:00 committed by GitHub
commit d3ae4d86c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -232,15 +232,15 @@ class Admin::ProceduresController < AdminController
def path_list def path_list
json_path_list = ProcedurePath json_path_list = ProcedurePath
.joins(', procedures') .joins(:procedure)
.where("procedures.id = procedure_paths.procedure_id") .where(procedures: { archived_at: nil })
.where("procedures.archived_at" => nil)
.where("path LIKE ?", "%#{params[:request]}%") .where("path LIKE ?", "%#{params[:request]}%")
.order(:id)
.pluck(:path, :administrateur_id) .pluck(:path, :administrateur_id)
.map do |value| .map do |path, administrateur_id|
{ {
label: value.first, label: path,
mine: value.second == current_administrateur.id mine: administrateur_id == current_administrateur.id
} }
end.to_json end.to_json