Two questions about the JSON about foodPreferences.
1. Empty foodPreferences in the example scenario
Section 2.2 (“Food preferences”) states:
In addition, customers within a group can name ingredients they prefer to eat, exclude from eating, as well as favorite dishes. Each preference must use 1–3 of those properties.
In the example scenario JSON, however, three of the four customer groups have an empty array:
json
{ "id": 3, "type": "REGULAR", ..., "foodPreferences": [] },
{ "id": 2, "type": "CASUAL", ..., "foodPreferences": [] },
{ "id": 5, "type": "CASUAL", ..., "foodPreferences": [] }
We read “each preference must use 1–3 of those properties” as every customer group must specify at least one preference object (excludedIngredients, prefferedIngredients, favoriteDishes), in which case the example would be invalid.
So the question is if "foodPreferences": [] is valid input that our validator must accept, or should it be rejected? And if it is valid, is it correct that those customers then fall under “If there are no preferences, customers select the dish with the highest recipe id”?
2. favoriteDishes in the EVENT example
The EVENT customer group in the second example JSON looks like this:
json
{
"id": 6, "type": "EVENT", "size": 16, "tableType": "COMMON",
"visitingTick": 4, "foodPreferences": [],
"restaurantTypes": ["EUROPEAN","AFRICAN"],
"foodPreferences": [{"size": 16, "excludedIngredients": ["chicken","potato"]}],
"eventEvening": 35,
"favoriteDishes": {"EUROPEAN": "potato soup"},
}
Here favoriteDishes appears directly on the customer group instead in the foodPreferences array and as an object mapping a restaurant type to a dish name, whereas inside a foodPreferences element favoriteDishes is an array of dish names.
-
Is it really a map
restaurantType → dishNameand is it used for choosing the restaurant, for choosing the dish or both? -
Can a group have both
favoriteDishesandfavoriteDishesinsidefoodPreferences? If they disagree, which takes precedence?