Terrastories / terrastories

Terrastories is a geostorytelling application for mapping, managing and sharing place-based stories.
https://terrastories.app
MIT License
319 stars 157 forks source link

[Rails][Administrate] Ensure that duplicate Places cannot be added using the importer #539

Closed mirandawang closed 3 years ago

mirandawang commented 4 years ago

For Places, admin are able to upload a CSV to bulk import data. However duplicate items can get added. Let’s update the import code so that duplicate items cannot be added.

Match on all fields. If this EXACT record already exists, do not recreate it. Just move on to the next row.

Sample CSV file: https://drive.google.com/file/d/1Ir6TC5THEoQKk-98JZ5KpTjXd-R6yMmA/view

Importer code for Places

You can log into the admin interface using the sample admin account from the db seeds.

Acceptance Criteria: When using the CSV importer, duplicate rows that have the same exact fields do not get added twice. Add unit tests for this behavior in each place_spec.rb

jaimevelaz commented 4 years ago

I've created a Pull request (https://github.com/Terrastories/terrastories/pull/551) to try to ensure places cannot be duplicated through the CSV importer, after adding the spec found that this cannot happen but having the spec may be useful for the future.

lauramosher commented 3 years ago

Thanks for digging into this, @jaimevelaz — since the PR you opened was merged, I'm going to close this issue.