-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
Conversions prevent Food Merge #2953
Comments
@smilerz you implemented merging in a very nice and generic way, I suspect its going to be tricky to get this to work right or do you think it could be added? If not we will just override the merge method for the food model to delete the property entries of the merged (looser) food. |
I've been thinking about how to handle for a little bit and not sure how to address this case. Are there any other relationships that could cause duplicates like this? |
Interestingly there are a few many to many fields on food, including all your inheritance fields. Property is the only one that has a specific trough relation model defined but that model has Edit: but this wasn't about relation but uniqueness. I think the problem is related to the script trying to copy the values from that relation. and thus creating duplicates. I would say that we might already have this problem with all many to many relations (e.g. We could enforce custom implementations as soon as a M2M relation is there or we could only merge full sets of M2M. E.g. lets say we merge B onto A, we only merge |
I think we actually have this piece of code in place to solve the properties issue but it might not be working if isinstance(source, Food):
source.properties.remove() still we should probably look at the set logic |
ok sorry i missread this the whole time, its about conversions not properties, though properties was also broken doubling relations and circumventing uniqueness. I think I solved both for now using
but merging stil probably needs some more attention or a dedicated method for each model to make sure strange things like this don't happen (although they could probably sneak in over time) |
Tandoor Version
1.5.11
Setup
Docker / Docker-Compose
Reverse Proxy
Caddy
Other
Technically Caddy Docker Proxy by Lucas Lorentz
Bug description
When attempting to merge two foods that had been assigned conversions, I received either no error (when drag and drop merge was attempted) or the error "There was an error merging a resource!
An error occurred attempting to merge oregano with dried oregano" (when using the 3 dot menu on the food to merge). This occurs both when the conversions are different and when they are exactly the same.
Relevant logs
The text was updated successfully, but these errors were encountered: