diff options
Diffstat (limited to 'modules')
| -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 05baf4a..ada4c4b 100644 --- a/modules/lists/lists.go +++ b/modules/lists/lists.go | |||
| @@ -537,13 +537,9 @@ func (m *Module) addGrilToList(w http.ResponseWriter, r *http.Request, p httprou | |||
| 537 | return | 537 | return |
| 538 | } | 538 | } |
| 539 | 539 | ||
| 540 | rank := 0 | ||
| 541 | if len(list.Grils) > 0 { | ||
| 542 | rank = list.Grils[len(list.Grils)-1].Order + 1 | ||
| 543 | } | ||
| 544 | |||
| 545 | // rein in die DB damit | 540 | // rein in die DB damit |
| 546 | _, err = m.g.DB.Exec(`INSERT INTO grilist.lists_grils(list_id, gril_id, "order") VALUES($1, $2, $3)`, listID, grilID, rank) | 541 | _, err = m.g.DB.Exec(`INSERT INTO grilist.lists_grils(list_id, gril_id, "order") |
| 542 | VALUES($1, $2, (SELECT count(gril_id) FROM grilist.lists_grils WHERE list_id = $1));`, listID, grilID) | ||
| 547 | if err != nil { | 543 | if err != nil { |
| 548 | log.Println("error inserting gril into list:", err) | 544 | log.Println("error inserting gril into list:", err) |
| 549 | http.Error(w, "could not insert gril", 500) | 545 | http.Error(w, "could not insert gril", 500) |
