Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎁 remove whitespaces from CSV headers #816

Merged
merged 14 commits into from
Jun 26, 2023

Conversation

ShanaLMoore
Copy link
Contributor

@ShanaLMoore ShanaLMoore commented Jun 13, 2023

Summary

Before this code, I spent a lot of time confused about why my importer wasn't working. I couldn't find any helpful errors to assist. It turns out the failure was because my CSV accidentally had a white space in one of its headers. "parents " instead of "parents". This code will remove any white spaces in the headers.

Screenshots / Video

Screenshot 2023-06-13 at 1 12 12 PM

AFTER

Screenshot 2023-06-13 at 1 12 20 PM

Expected Behavior

  • The CSV importer should be able to handle headers with white spaces.

@ShanaLMoore ShanaLMoore added the patch-ver for release notes label Jun 13, 2023
@ShanaLMoore ShanaLMoore marked this pull request as draft June 13, 2023 21:05
@ShanaLMoore
Copy link
Contributor Author

TODO:

look into and resolve failing specs

@jeremyf jeremyf marked this pull request as ready for review June 21, 2023 01:28
@@ -20,7 +20,7 @@ def self.read_data(path)
raise StandardError, 'CSV path empty' if path.blank?
options = {
headers: true,
header_converters: ->(h) { h.to_sym },
header_converters: ->(h) { h.to_s.strip.to_sym },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈 @jeremyf this is a much better implementation! thank you!

@ShanaLMoore ShanaLMoore merged commit 858f472 into main Jun 26, 2023
@ShanaLMoore ShanaLMoore deleted the handle-whitepaces-in-csv-headers branch June 26, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch-ver for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants