Possible easy improvement to smart chef demo



I don’t know how far along is everyone. I am able to modify the steak recipe. As I do it, I found an issue.

Problem: I learned that currently the demo requires both the steak recipes.recipe.step and recipes.steps to be updated to be exact same. It seems that these two arrays must have same length and same array elements. It is difficult to make certain changes to the steak recipe. It forces me to delete the recipes.step array and create a new array if I want to have a shorter steak recipe. (I wonder if I am correct. Does anyone have a similar experience with this issue?)

Solution: Luckily, I am able to improve the python code with a simple one line change for Recipe Flow and Process Sensor Rules flowcharts. So, it can be different length as long as recipes.recipe. steps have all the steps in recipes.recipe.step array.

      #if current_step == len(steps): # original code
      if current_step == len(recipe_steps): # modified code for a case when recipe_steps is shorter than state.steps

Benefits from this simple change:

  1. It is flexible now. You can delete a step from steak recipe without changing recipes.steps.

  2. You can replace a step with a new step easily. For example, you can just add the additional new step (pre-heat 120) to recipes.step and replace pre-heat 100 with pre-heat 120 in recipes.recipe.step. No big changes are needed for recipes.step.

  3. You can add a new step like before. This case is not a problem with the original code.

Give me a feedback if you can. I’d like to hear what you think.

Thank you.