From 6960d0e4177fe42c9141f8ad6f224fa400007e64 Mon Sep 17 00:00:00 2001 From: Kas Kranenburg Date: Mon, 14 Oct 2024 09:51:25 +0200 Subject: [PATCH] Reversing importable commit changes --- app/services/csv_importer/importable_commit.rb | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/app/services/csv_importer/importable_commit.rb b/app/services/csv_importer/importable_commit.rb index e5511ca1..5eb7b21b 100644 --- a/app/services/csv_importer/importable_commit.rb +++ b/app/services/csv_importer/importable_commit.rb @@ -21,22 +21,12 @@ def build_commit(dataset, row) @keys.each do |key| value = row[key] - # Use the custom `find` method which expects a key - current_attr = current.find(key) - - if value - if current_attr - if value != current_attr.value - commit.dataset_edits.build(key: key, value: value) - end - else - # Log a warning if the key is not found in editable_attributes - warn "Warning: Key '#{key}' not found in editable_attributes for dataset '#{dataset.geo_id}'. Skipping this key." - end + if value && value != current.find(key).value + commit.dataset_edits.build(key: key, value: value) end end commit end end -end \ No newline at end of file +end