From 5d5580285a366e37ac00a4e1a6f2f1bda853ff28 Mon Sep 17 00:00:00 2001 From: xengineering Date: Fri, 17 May 2024 23:08:05 +0200 Subject: model: Fix ignored error An ignored return value here caused a serious bug as soon as validation for ingredients was tried. The validation could raise an error e.g. on a negative amount for the ingredient. This error was ignored at the changed line which resulted into deleted ingredients for the whole recipe. --- model/recipe.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'model') diff --git a/model/recipe.go b/model/recipe.go index a9bd0fe..e49c188 100644 --- a/model/recipe.go +++ b/model/recipe.go @@ -201,7 +201,7 @@ func (r *Recipe) Update(tx *sql.Tx) error { for i := range r.Steps { r.Steps[i].Index = fmt.Sprint(i) r.Steps[i].Recipe = r.Id - r.Steps[i].Create(tx) + err = r.Steps[i].Create(tx) if err != nil { return err } -- cgit v1.2.3-70-g09d2