OBPIH-7414 fix duplicate tags and categories being created during pro…#5404
Merged
awalkowiak merged 2 commits intodevelopfrom Jul 25, 2025
Merged
OBPIH-7414 fix duplicate tags and categories being created during pro…#5404awalkowiak merged 2 commits intodevelopfrom
awalkowiak merged 2 commits intodevelopfrom
Conversation
ewaterman
commented
Jul 23, 2025
| } | ||
|
|
||
| tag = new Tag(tag: tagName) | ||
| if (!tag.save()) { |
Member
Author
There was a problem hiding this comment.
Note that after this refactor, we don't need to flush the cache when saving tags anymore since we're directly returning and using them (whereas before we'd try to fetch from the db later and so we had to ensure the db session was flushed).
awalkowiak
approved these changes
Jul 24, 2025
alannadolny
approved these changes
Jul 24, 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.
…duct import
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-7414
Description: Two issues:
tags: "x, y"would result in tags "x" and " y" (note the space). So even if we already have a tag "y", "y" != " y", so we'd still create a new oneI refactored the code to first gather a list of all tags and categories being imported, then get or create them all in a batch, then use that result (without fetching from the db again) to populate the tags and categories in the product.
📷 Screenshots & Recordings (optional)
Here's a video showcasing the bug: https://www.loom.com/share/1a600be8b48e423eba8ba871bdff2b44