I'm new to the Watson framework and I'm trying to make a bot that helps with cooking, the way I'm currently doing a dialog is saving every instance of ingredient the user types in an array like so:
If user writes "What can I make with salt and oil"
Then the array willl be: Ingrediente:["salt","oil"]
What I want to do then is add its corresponding dish depending if the Ingrediente
array contains a certain ingredient, for example if Ingrediente
has both "salt" and "oil", the array ListaPlatillos
will be appended the values "Steak" and "Salad" corresponding to the elements in the Ingrediente
array respectively, I'm trying to do it inside a slot like so:
The conditions are written like so:
($Ingrediente.contains('Sal') || $Ingrediente.contains('Sal de grano')) && !$ListaPlatillos.contains('Ensalada de ejote asado con menta y queso feta ')
And the LisaPlatillos
is appended like so:
"context": {
"ListaPlatillos": "<? context.ListaPlatillos.append( 'Ensalada de ejote asado con menta y queso feta ' ) ?>"
}
The problem is that only the first condition is checked and thus only the first dish is appended, what's the correct/best way to update ListaPlatillos
depending on the values of Ingrediente
?