diff options
author | rtz12 <koenig@fagott.pw> | 2017-04-12 17:08:18 (UTC) |
---|---|---|
committer | rtz12 <koenig@fagott.pw> | 2017-04-12 17:08:18 (UTC) |
commit | 1ca3718b9f0aa43ef06677c899184526b7359120 (patch) | |
tree | 7ff841ed428ae0407f77d4a9b49dd344b9b006a6 /modules | |
parent | 1d8f9871455ac4e7a124b82a24a31ed18ed961aa (diff) | |
parent | 6243b499153e43a2226a6c490afbe230e04b4677 (diff) |
Merge branch 'master' of projekte.fagott.pw:grilist
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 ada4c4b..94d485e 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)) |