aboutsummaryrefslogtreecommitdiff
path: root/modules/lists
diff options
context:
space:
mode:
Diffstat (limited to 'modules/lists')
-rw-r--r--modules/lists/lists.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/lists/lists.go b/modules/lists/lists.go
index c699271..455c39c 100644
--- a/modules/lists/lists.go
+++ b/modules/lists/lists.go
@@ -695,7 +695,7 @@ func (m *Module) removeGrilFromList(w http.ResponseWriter, r *http.Request, p ht
695 return 695 return
696 } 696 }
697 697
698 err = m.g.DB.QueryRow(`DELETE FROM grilist.lists_grils WHERE list_id=$1 AND gril_id=$2`, listID, grilID).Scan(&oldOrder) 698 err = m.g.DB.QueryRow(`DELETE FROM grilist.lists_grils WHERE list_id=$1 AND gril_id=$2 RETURNING "order"`, listID, grilID).Scan(&oldOrder)
699 if err != nil { 699 if err != nil {
700 log.Println("error removing gril:", err) 700 log.Println("error removing gril:", err)
701 http.Error(w, "could not remove gril", 500) 701 http.Error(w, "could not remove gril", 500)
@@ -708,6 +708,12 @@ func (m *Module) removeGrilFromList(w http.ResponseWriter, r *http.Request, p ht
708 http.Error(w, "could not remove gril", 500) 708 http.Error(w, "could not remove gril", 500)
709 return 709 return
710 } 710 }
711
712 if r, err := res.RowsAffected(); err != nil || r == 0 {
713 log.Println("invalid rows affected in removing gril")
714 http.Error(w, "gril not in list / other error", 500)
715 return
716 }
711 717
712 list.Grils = list.Grils[:0] 718 list.Grils = list.Grils[:0]
713 719