About foodPreferences

In the specification is a foodPreference with favoriteDish PotatoSoup but the excluded Ingredients Potato so that the customers with that preference can’t chose PotatoSoup bacause that Recipe has the Ingredient Potato. Is that a mistake or not? Is that not something that the validator would catch as an error?

2 Likes

Not a mistake, and the validator must not reject it.

Precedence when a customer picks a dish is: excluded ingredients (hard filter) > event favorite > own favoriteDishes > preferred ingredients > highest recipe id. Exclusions are a hard filter applied before any favorite is considered,

“They only select among dishes where they eat all ingredients”

So PotatoSoup simply drops out of that customer’s candidate set and they fall through to the next rule. An unreachable favorite is a preference that never fires, not a contradiction.

Same logic covers the event case: an event customer who excludes an ingredient of the event’s favorite dish just falls back to their own rules.

3 Likes