-
Notifications
You must be signed in to change notification settings - Fork 134
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
Problem with amounts in inventory #532
Comments
Interesting. Reproduces for me and I think it's a bug. When the malt gets copied, the inventory_id on the new copy is the same as the old one, so they effectively share an inventory record. The trouble is that, sometimes, a copy of something is intended to be linked to the original one and sometimes it isn't. When you add an ingredient to a recipe, under the hood, the software makes a copy of it and add the copy but with a link back to the original "master" ingredient. (I presume it's so you can edit, say, alpha acid on a hop in a recipe without affecting the value in other recipes that use the same hop.) In such instances, you do want them to share an inventory ID. But when you manually make a copy of a hop or malt, you probably don't want this behaviour. I haven't looked at this bit of the code, so I don't know offhand whether there is a quick fix for this. Longer-term, I want to change the data model so that there's a lot less "magic copying" going on behind the scenes. This involves a bit of a refactor, which I've started, but which may take some time. |
The bug isn't necessarily in the code, it's in the design. Still my fault, but the code is doing exactly what I had intended and expected. I just hadn't considered this use-case. I think we may be able to make a reasonable slice at this. If you use the real copy feature, get a new inventory ID. If you are dropping or otherwise adding the ingredient to a recipe, then don't. Let me see if that can be made to make sense. If it doesn't, we can at least add something to the copy dialog. The "magic copying" is there for some reasonable reasons. They may not be good, but they are reasonable. Some has to do with the original formats. There was no kind of reference or pointer built into beerXML. So when everything was stored in BeerXML, you had to make a copy every time you added an ingredient. When we converted to the sqlite, we kept those mechanisms in place. As it stands now, it has some advantages. For example, hops change %AA all the time. I have had centennial ranging from 8% - 14% AA. If I get a new kilo of centennial, I will adjust the %AA in the master record. But what I don't want is for that to change all the recipes using centennial. If I crafted the recipe to have 28g of centennial at 8% AA, I really do not want it to suddenly become 28g of centennial at 14% AA. The difference lets me know I need to adjust the amount. |
Sorry for the delay. Just after I commented it, my internet connection died. It's fixed now, and I think this is too. |
Closes #532 -- Problem with amounts in inventory
I found interesting feature in inventory management. I added new malt - it was the same type from different supplier. So I copied the existing to the new one. Entered new amount and it changed in old and new one (source and copy). It is the same with hops. Is it a bug or new feature?
The text was updated successfully, but these errors were encountered: