From 65a7c5c73b80c22e70246d4cf330ee23e147e54b Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 22 Feb 2023 12:02:37 +0100 Subject: [PATCH] (bug) wrong namespace for task fix:cart_operator --- CHANGELOG.md | 2 ++ lib/tasks/fablab/fix.rake | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d94ec0a6..9b1d530b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ - Improved upgrade script - Fix a bug: empty advanced accounting code is not defaulted to the general setting - Fix a bug: invalid style in accounting codes settings +- Fix a bug: wrong namespace for task cart_operator +- [TODO DEPLOY] `rails fablab:fix:cart_operator` - [TODO DEPLOY] `rails fablab:setup:build_accounting_lines` ## v5.8.1 2023 March 03 diff --git a/lib/tasks/fablab/fix.rake b/lib/tasks/fablab/fix.rake index b2d70705f..edfff75a5 100644 --- a/lib/tasks/fablab/fix.rake +++ b/lib/tasks/fablab/fix.rake @@ -294,15 +294,15 @@ namespace :fablab do Fablab::Application.load_tasks if Rake::Task.tasks.empty? Rake::Task['fablab:chain:invoices_items'].invoke end - end - desc '[release 5.7] fix operator of self-bought carts' - task cart_operator: :environment do |_task, _args| - Order.where.not(statistic_profile_id: nil).find_each do |order| - order.update(operator_profile_id: order.user&.invoicing_profile&.id) - end - Order.where.not(operator_profile_id: nil).find_each do |order| - order.update(statistic_profile_id: order.operator_profile&.user&.statistic_profile&.id) + desc '[release 5.6] fix operator of self-bought carts' + task cart_operator: :environment do |_task, _args| + Order.where.not(statistic_profile_id: nil).find_each do |order| + order.update(operator_profile_id: order.user&.invoicing_profile&.id) + end + Order.where.not(operator_profile_id: nil).find_each do |order| + order.update(statistic_profile_id: order.operator_profile&.user&.statistic_profile&.id) + end end end end