25 lines
417 B
Go
25 lines
417 B
Go
package recipe
|
|
|
|
import (
|
|
"autobrew/action"
|
|
"autobrew/ingredient"
|
|
)
|
|
|
|
type Recipe struct {
|
|
Steps []Step
|
|
Ingredients []ingredient.Ingredient
|
|
}
|
|
|
|
func (r *Recipe) LoadIngredients() {
|
|
for _, step := range r.Steps {
|
|
if step.Action == action.Prepare {
|
|
for _, i := range step.Ingredients {
|
|
if i.IngredientType != ingredient.Base {
|
|
r.Ingredients = append(r.Ingredients, i)
|
|
}
|
|
}
|
|
break
|
|
}
|
|
}
|
|
}
|