Open cstarkers opened 3 years ago
This could be interesting from a UI perspective. When you change the equipment on a recipe, you get a prompt asking you whether you want to update batch size etc on the recipe to match the new equipment. If you edit the equipment that might be used by quite a few different recipes, then I guess we'd need to ask "Do you want to update all the following recipes that use this equipment".
The other thing I can't remember is whether recipe makes its own copy of equipment or not. Eg, when you add a hop to a recipe, it makes a copy of the hop which then has a link back to the original master record for that hop. I'm not 100% sure why it's done this way, but I guess it means you can edit everything about a recipe without worrying about changing other recipes. OTOH I can't immediately see a way to edit equipment (rather than select different equipment profile) inside a recipe. Probably @mikfire knows a lot more.
Oh interesting. I definitely see merit in keeping the recipe's equipment separate from the global equipments, because then you could make tweaks for individual brews without filling the equipment tree with minor variations.
If that is the intended behaviour then I think there are a few issues. I think the UI should somehow make it clear that when you pick an equipment in the Recipe tab, it is more like an equipment template, or a starting point. Then, the equipment editor which is accessed via the recipe tab needs to change the recipe equipment, not the global equipment. The editor accessed via the equipment tree should still change the global equipment.
Finally there's the question of what do you do when a user changes the global equipment, and some recipes (probably most recipes for most users) previously used an exact copy of the global equipment - should the old recipes change? Maybe we give the user a confusing pop up and ask them?
I have plenty of time next week. I will try to get over my fear of Qt and get a PR together
FYI, I think I lack the time and ability to work on this.
I am still not sure whether the described behavior is as intended, and if not what the intended behavior is. For what it's worth, if the current behavior is what is intended, I personally find it very unintuitive. Given my uncertainty I will leave this issue open in case a better person than me wants to tackle it
No worries. I'm inclined to agree. In fairness, I think, as @mikfire has commented on another ticket, some of the behaviour stems from a long while back when Brewtarget was originally storing all its data in individual BeerXML files, and cross-references were hard to do. The initial work to move storage into a relational database was quite an epic task (described by @mikfire in https://github.com/Brewtarget/brewtarget/blob/develop/dev-doc/database.markdown) and it stayed understandably close to that initial data-model.
My instinct is that moving to a more "relational" data model would make fixing these sorts of bugs and adding certain types of new feature a lot easier. And I think it's also time to improve the encapsulation and simplify the code that accesses the database so that it does not need to know so much about the inner workings of the object model. I've started some work to see if I can make such an approach fly, but it's quite a chunky change, so it may be a while before I've got anything to share.
Maybe when you go to brew (or open a saved recipe) a dialog telling you that the equipment profile you used last has changed, and would you like to use your current equipment?
I made a mistake in my equipment. After trying to enter a recipe, I fixed and saved the equipment. The change to equipment saved, but all of the recipe calculations (batch size, boil size, and mash wiz) refused to adopt the edited equipment numbers - it was invisibly applying the old numbers.
I found a hacky work around - change the equipment to a different set of equipment and then change it back.
I will attempt a fix, but I am a novice (and I hate Qt), so this is likely beyond me.