diff options
| -rw-r--r-- | modules/lists/lists.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/modules/lists/lists.go b/modules/lists/lists.go index b4d944b..94d485e 100644 --- a/modules/lists/lists.go +++ b/modules/lists/lists.go | |||
| @@ -539,13 +539,9 @@ func (m *Module) addGrilToList(w http.ResponseWriter, r *http.Request, p httprou | |||
| 539 | return | 539 | return |
| 540 | } | 540 | } |
| 541 | 541 | ||
| 542 | rank := 0 | ||
| 543 | if len(list.Grils) > 0 { | ||
| 544 | rank = list.Grils[len(list.Grils)-1].Order + 1 | ||
| 545 | } | ||
| 546 | |||
| 547 | // rein in die DB damit | 542 | // rein in die DB damit |
| 548 | _, err = m.g.DB.Exec(`INSERT INTO grilist.lists_grils(list_id, gril_id, "order") VALUES($1, $2, $3)`, listID, grilID, rank) | 543 | _, err = m.g.DB.Exec(`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) | ||
| 549 | if err != nil { | 545 | if err != nil { |
| 550 | log.Println("error inserting gril into list:", err) | 546 | log.Println("error inserting gril into list:", err) |
| 551 | http.Error(w, "could not insert gril", 500) | 547 | http.Error(w, "could not insert gril", 500) |
