diff options
author | keiser <keiserwiliem@googlemail.com> | 2016-12-01 16:38:31 (UTC) |
---|---|---|
committer | keiser <keiserwiliem@googlemail.com> | 2016-12-01 16:38:31 (UTC) |
commit | 6243b499153e43a2226a6c490afbe230e04b4677 (patch) | |
tree | 55924d3ffab639e9b88d1510f3dc2e1e019bde29 /modules | |
parent | 09b7406c21eec7e9919aeb2a29375bd573a4bb51 (diff) |
Für dich Jan
Diffstat (limited to 'modules')
-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 05baf4a..b4d944b 100644 --- a/modules/lists/lists.go +++ b/modules/lists/lists.go | |||
@@ -84,6 +84,7 @@ func (m *Module) getListGrils(list *models.List) error { | |||
84 | defer rows.Close() | 84 | defer rows.Close() |
85 | list.Grils = list.Grils[:0] | 85 | list.Grils = list.Grils[:0] |
86 | var ids []int | 86 | var ids []int |
87 | grilMap := make(map[int]*models.ListGril) | ||
87 | for rows.Next() { | 88 | for rows.Next() { |
88 | var grilID int | 89 | var grilID int |
89 | lg := &models.ListGril{} | 90 | lg := &models.ListGril{} |
@@ -93,6 +94,7 @@ func (m *Module) getListGrils(list *models.List) error { | |||
93 | continue | 94 | continue |
94 | } | 95 | } |
95 | ids = append(ids, grilID) | 96 | ids = append(ids, grilID) |
97 | grilMap[grilID] = lg | ||
96 | 98 | ||
97 | list.Grils = append(list.Grils, lg) | 99 | list.Grils = append(list.Grils, lg) |
98 | } | 100 | } |
@@ -103,8 +105,8 @@ func (m *Module) getListGrils(list *models.List) error { | |||
103 | return err | 105 | return err |
104 | } | 106 | } |
105 | 107 | ||
106 | for id, gril := range grils { | 108 | for _, gril := range grils { |
107 | list.Grils[id].Gril = gril | 109 | grilMap[gril.ID].Gril = gril |
108 | } | 110 | } |
109 | 111 | ||
110 | sort.Sort(ListGrils(list.Grils)) | 112 | sort.Sort(ListGrils(list.Grils)) |