Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctif : mise à jour d'un dossier réaffecté et sans groupe instructeur #9431

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lib/tasks/routing_engine.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require Rails.root.join("lib", "tasks", "task_helper")

namespace :routing_engine do
desc <<~EOD
Given an id in argument, run the RoutingEngine for a dossier, after having set `forced_groupe_instructeur` field to false.
ex: rails routing_engine:run\[1352684\]
EOD
task :run, [:dossier_id] => :environment do |_t, args|
dossier = Dossier.find_by(id: args[:dossier_id])

if dossier.present?
dossier.update!(forced_groupe_instructeur: false)

dossier.reload

RoutingEngine.compute(dossier)

rake_puts "Dossier #{args[:dossier_id]} routed to groupe instructeur #{dossier.groupe_instructeur.label}"
else
rake_puts "Dossier with id #{args[:dossier_id]} not found in db"
end
end
end