Skip to content

Commit

Permalink
Updating commit messages of Noord-holland 2022 dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
kaskranenburgQ committed Oct 7, 2024
1 parent 85d5d00 commit 2c0cb19
Show file tree
Hide file tree
Showing 4 changed files with 863 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ GEM
libv8-node (~> 16.10.0.0)
minitest (5.22.2)
msgpack (1.6.0)
mysql2 (0.5.5)
mysql2 (0.5.6)
net-imap (0.4.10)
date
net-protocol
Expand Down Expand Up @@ -440,6 +440,7 @@ PLATFORMS
arm64-darwin-20
arm64-darwin-21
arm64-darwin-22
arm64-darwin-23
x86_64-darwin-21
x86_64-darwin-22
x86_64-linux
Expand Down
16 changes: 13 additions & 3 deletions app/services/csv_importer/importable_commit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@ def build_commit(dataset, row)
@keys.each do |key|
value = row[key]

if value && value != current.find(key).value
commit.dataset_edits.build(key: key, value: value)
# 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
end
end

commit
end
end
end
end
Loading

0 comments on commit 2c0cb19

Please sign in to comment.