I added a column showing how many times a recipe can be made given the current pantry.
I added a method to the Query Class that given a recipe, the number is returned.
This number is computed as MIN(numberInPantry/numberInRecipe) over the ingredients.
To easily add this to the DataGrid, I made a hack and added the query class to the Recipe Object so I could expose this as a property on the recipe.
This is very inefficient for 2 reasons,
A separate query is made for each recipe
There is no caching, this is recomputed every time we visit the screen
I added a column showing how many times a recipe can be made given the current pantry.
I added a method to the Query Class that given a recipe, the number is returned. This number is computed as
MIN(numberInPantry/numberInRecipe)
over the ingredients.To easily add this to the DataGrid, I made a hack and added the query class to the Recipe Object so I could expose this as a property on the recipe.
This is very inefficient for 2 reasons,