aboutsummaryrefslogtreecommitdiff
path: root/modules/lists
diff options
context:
space:
mode:
Diffstat (limited to 'modules/lists')
-rw-r--r--modules/lists/lists.go6
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))