-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix: bug importing tags with the same value as an existing one #141
Merged
bradenmacdonald
merged 1 commit into
openedx:main
from
open-craft:rpenido/fal-3603-fix-import-tag-with-same-value
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rpenido Maybe to avoid this loop, you can add the delete actions first using the
_build_action()
func, adding a new paramadd_first
. What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first attempt was just to change the
self.actions.append(action)
toself.actions.insert(0, action)
for the DeleteTag here (this was your suggestion?):openedx-learning/openedx_tagging/core/tagging/import_export/import_plan.py
Lines 64 to 65 in 7072032
This didn't solve the problem because we ran the validation below (inside
_build_action()
for the CreateTag action) in the plan stage (before actually running the delete action).openedx-learning/openedx_tagging/core/tagging/import_export/import_plan.py
Lines 61 to 62 in 7072032
openedx-learning/openedx_tagging/core/tagging/import_export/actions.py
Lines 120 to 127 in 7072032
I need to skip this validation if the tag value has a DeleteTag action, so I need to build all the delete actions (calling
_build_delete_actions
) before validating the new tags.I also tried to avoid this loop filtering while we constructed the dict here:
openedx-learning/openedx_tagging/core/tagging/import_export/import_plan.py
Lines 138 to 140 in 7072032
But because we have tags (from the DB) and tags (from the importing param), the filtering code became nearly intelligible, so I opted for the loop outside (since it is not a nested loop).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is my suggestion.
I see, in that case the loop is fine. Thanks for the explanation!