diff options
-rw-r--r-- | modules/grils/grils.go | 3 | ||||
-rw-r--r-- | modules/lists/lists.go | 20 |
2 files changed, 14 insertions, 9 deletions
diff --git a/modules/grils/grils.go b/modules/grils/grils.go index 0fac5df..8382897 100644 --- a/modules/grils/grils.go +++ b/modules/grils/grils.go | |||
@@ -60,8 +60,7 @@ func (m *GrilsModule) getGrils(whereClause string, params ...interface{}) ([]*mo | |||
60 | gril.KanjiName = *kanjiName | 60 | gril.KanjiName = *kanjiName |
61 | } | 61 | } |
62 | 62 | ||
63 | gril.Tags = util.PGArray(tags) | 63 | m.c.Insert(gril.ID, gril) |
64 | gril.OtherNames = util.PGArray(otherNames) | ||
65 | 64 | ||
66 | m.c.Insert(gril.ID, gril) | 65 | m.c.Insert(gril.ID, gril) |
67 | 66 | ||
diff --git a/modules/lists/lists.go b/modules/lists/lists.go index 387e48a..05baf4a 100644 --- a/modules/lists/lists.go +++ b/modules/lists/lists.go | |||
@@ -83,6 +83,7 @@ func (m *Module) getListGrils(list *models.List) error { | |||
83 | 83 | ||
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 | for rows.Next() { | 87 | for rows.Next() { |
87 | var grilID int | 88 | var grilID int |
88 | lg := &models.ListGril{} | 89 | lg := &models.ListGril{} |
@@ -91,16 +92,21 @@ func (m *Module) getListGrils(list *models.List) error { | |||
91 | log.Println("error scanning row in getListGrils:", err) | 92 | log.Println("error scanning row in getListGrils:", err) |
92 | continue | 93 | continue |
93 | } | 94 | } |
94 | 95 | ids = append(ids, grilID) | |
95 | gril, err := m.grils.FromID(grilID) | ||
96 | if err != nil { | ||
97 | log.Println("error getting listGril:", err) | ||
98 | continue | ||
99 | } | ||
100 | lg.Gril = gril | ||
101 | 96 | ||
102 | list.Grils = append(list.Grils, lg) | 97 | list.Grils = append(list.Grils, lg) |
103 | } | 98 | } |
99 | |||
100 | // grils holen | ||
101 | grils, err := m.grils.FromIDs(ids) | ||
102 | if err != nil { | ||
103 | return err | ||
104 | } | ||
105 | |||
106 | for id, gril := range grils { | ||
107 | list.Grils[id].Gril = gril | ||
108 | } | ||
109 | |||
104 | sort.Sort(ListGrils(list.Grils)) | 110 | sort.Sort(ListGrils(list.Grils)) |
105 | return nil | 111 | return nil |
106 | } | 112 | } |