General
I’m making a small cookbook app (nothing fancy).
My home screen is a list_viewer connected to a local table (Recipe).
When the user click on a recipe, it opens a screen with more informations (like ingredients and instructions).
Tables
Recipes : one line per recipe with the name, description, etc. of the recipe.
Ingredients : Multiple lines per recipe, each line being one ingredient.
To prevent extensive loops, in the Recipes table, there are columns for the start and end IDs of each ingredient. For example, a recipe with ID 0 has value 0 for column “ingr_start” and a value of 5 for another column named “ingr_end”, indicating that ingredients with IDs ranging from 0 to 5 belong to recipe 0.
Truncated recipes table :
Ingredients table:
Blocks
Here are the block for the home screen (works correctly) :
Here the blocks of the recipe screen:
(the final version will put the text in a list, but here I’m just working with the ids for debugging purposes).
What’s not working
As you can see in the upd_ingr function, the i variable should iterate from the ingr_start to the ingr_end (so taking the value if 0, then 1, then 2…up to 5 for the first recipe). but it does not :
I think the problem comes from the ingr_start property, because if I change the loop by this :
then it works ! (well i iterate from ingr_end - 5 to ingr_end)
Here is what is suppose to happen :
If I try from (ingr_start) to (ingr_start + 5) → doesn’t work (that’s why I suppose the problem comes from this property).
I can’t find out why this is not working and at this point, I think it’s a bug