diff options
-rw-r--r-- | modules/lists/lists.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/lists/lists.go b/modules/lists/lists.go index 94d485e..215ab9c 100644 --- a/modules/lists/lists.go +++ b/modules/lists/lists.go | |||
@@ -540,8 +540,10 @@ func (m *Module) addGrilToList(w http.ResponseWriter, r *http.Request, p httprou | |||
540 | } | 540 | } |
541 | 541 | ||
542 | // rein in die DB damit | 542 | // rein in die DB damit |
543 | _, err = m.g.DB.Exec(`INSERT INTO grilist.lists_grils(list_id, gril_id, "order") | 543 | row := m.g.DB.QueryRow(`INSERT INTO grilist.lists_grils(list_id, gril_id, "order") |
544 | VALUES($1, $2, (SELECT count(gril_id) FROM grilist.lists_grils WHERE list_id = $1));`, listID, grilID) | 544 | VALUES($1, $2, (SELECT count(gril_id) FROM grilist.lists_grils WHERE list_id = $1)) RETURNING "order";`, listID, grilID) |
545 | var rank int | ||
546 | err = row.Scan(&rank) | ||
545 | if err != nil { | 547 | if err != nil { |
546 | log.Println("error inserting gril into list:", err) | 548 | log.Println("error inserting gril into list:", err) |
547 | http.Error(w, "could not insert gril", 500) | 549 | http.Error(w, "could not insert gril", 500) |