Fix taxonomy serialization for export/imports#13857
Merged
Conversation
8 tasks
|
It seems like you did not give us much information about what you are trying to do here. We would appreciate it if you could provide us with more info about this issue/PR! |
alecslupu
suggested changes
Jan 15, 2025
Contributor
alecslupu
left a comment
There was a problem hiding this comment.
Looking good by reading the code, but I would simplify a bit.
decidim-accountability/lib/decidim/accountability/result_serializer.rb
Outdated
Show resolved
Hide resolved
decidim-accountability/lib/decidim/accountability/result_serializer.rb
Outdated
Show resolved
Hide resolved
decidim-assemblies/app/serializers/decidim/assemblies/assembly_serializer.rb
Outdated
Show resolved
Hide resolved
decidim-conferences/app/serializers/decidim/conferences/conference_serializer.rb
Outdated
Show resolved
Hide resolved
...rocesses/app/serializers/decidim/participatory_processes/participatory_process_serializer.rb
Outdated
Show resolved
Hide resolved
Contributor
Author
|
Good points @alecslupu I didn't realize that models where always aliased as |
alecslupu
approved these changes
Jan 16, 2025
greenwoodt
pushed a commit
to greenwoodt/decidim
that referenced
this pull request
Jan 21, 2025
entantoencuanto
added a commit
that referenced
this pull request
Jan 24, 2025
* develop: (30 commits) Change hardcoded english in seeds (#13917) Allow importing accountability results from a Proposals component (#13817) Remove user interests (#13910) Move remaining categories from some resources to taxonomies (#13838) Fix translation issue on import projects mailer (#13894) Update DownloadYourData exports for decidim-debates (#13895) Allow admins to publish the questions' answers in surveys (#13786) Fix flaky spec in autocomplete (#13901) Refine taxonomy filters (part 2) (#13725) Fix single attachment with title (#13795) Fix incorrect breadcrumb encoding on mobile and tablet (#13891) Add string for unpublish survey admin log message (#13890) Fix ux meeting date location (#13872) New Crowdin updates (#13767) Fix deleted user error in schema (#13681) Remove assembly types from user interaction (#13881) Remove participatory process types from user interaction (#13880) Lock concurrent-ruby to 1.3.4 (#13879) Fix taxonomy serialization for export/imports (#13857) Adjust form upload label changes (#13836) ...
antopalidi
pushed a commit
to openpoke/decidim
that referenced
this pull request
Feb 12, 2025
andreslucena
pushed a commit
that referenced
this pull request
Mar 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
There are some problems while serializing taxonomies. Usually, a resource can have multiple taxonomies and the current export method is not well structured. CSV exports are messy too if there are more than one taxonomy.
This PR should fix exports and imports when taxonomies involved
Notes on taxonomy serialization:
Categories where a one-to-one relation with resources. Taxonomies are one-to-many. As the CSV exporter is not well equiped to deal with arrays, I've decided to transform them to an object with keys => values in this manner:
As is shown, there one key
idscontaining an array with all the taxonomy IDs for the resource. This comes in handy on imports, as this is the only column used to find the related taxonomies. The rest of the keys are just the ids of the taxonomies pointing to the name of the taxonomy.📌 Related Issues
Link your PR to an issue
Testing
Describe the best way to test or validate your PR.
📷 Screenshots
JSON Export:

CSV Export:
