From 9c51615b03e3c34cd0d6b762df1cdb7a186d661d Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 16 Sep 2024 11:42:58 +1000 Subject: [PATCH] Anonymise customer first and last names These were added a couple of years ago in https://github.com/openfoodfoundation/openfoodnetwork/pull/8763 But I guess we never noticed the names weren't getting anonymised. The old 'name' field is still in the DB. It was kept for compatibility during migraiton but never cleaned up. I've added the tech debt task to the welcome new devs board now: https://github.com/openfoodfoundation/openfoodnetwork/issues/8835 --- lib/tasks/data/anonymize_data.rake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/tasks/data/anonymize_data.rake b/lib/tasks/data/anonymize_data.rake index d5a6a8f558..250e8d44b1 100644 --- a/lib/tasks/data/anonymize_data.rake +++ b/lib/tasks/data/anonymize_data.rake @@ -46,10 +46,14 @@ namespace :ofn do unconfirmed_email = concat(id, '_ofn_user@example.com')") Customer.where(user_id: nil) .update_all("email = concat(id, '_ofn_customer@example.com'), - name = concat('Customer Number ', id, ' (without connected User)')") + name = concat('Customer Number ', id, ' (without connected User)'), + first_name = concat('Customer Number ', id), + last_name = '(without connected User)'") Customer.where.not(user_id: nil) .update_all("email = concat(user_id, '_ofn_user@example.com'), - name = concat('Customer Number ', id, ' - User ', user_id)") + name = concat('Customer Number ', id, ' - User ', user_id), + first_name = concat('Customer Number ', id), + last_name = concat('User ', user_id)") Spree::Order.update_all("email = concat(id, '_ofn_order@example.com')") end