diff options
Diffstat (limited to 'modules/grils')
-rw-r--r-- | modules/grils/grils.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/grils/grils.go b/modules/grils/grils.go index 0fac5df..b0aa486 100644 --- a/modules/grils/grils.go +++ b/modules/grils/grils.go | |||
@@ -201,13 +201,17 @@ func (m *GrilsModule) FromIDs(ids []int) ([]*models.Gril, error) { | |||
201 | idList += strconv.Itoa(v) | 201 | idList += strconv.Itoa(v) |
202 | } | 202 | } |
203 | idList += ")" | 203 | idList += ")" |
204 | grils, err := m.getGrils("id IN " + idList) | 204 | if len(idList) > 2 { |
205 | 205 | grils, err := m.getGrils("id IN " + idList) | |
206 | for _, g := range grils { | 206 | if err != nil { |
207 | list = append(list, g) | 207 | return nil, err |
208 | } | ||
209 | for _, g := range grils { | ||
210 | list = append(list, g) | ||
211 | } | ||
208 | } | 212 | } |
209 | log.Printf("get_gril_from_ids: %dms", time.Since(t1).Nanoseconds()/1000000) | 213 | log.Printf("get_gril_from_ids: %dms", time.Since(t1).Nanoseconds()/1000000) |
210 | return list, err | 214 | return list, nil |
211 | } | 215 | } |
212 | 216 | ||
213 | func (m *GrilsModule) viewGril(w http.ResponseWriter, r *http.Request, p httprouter.Params) { | 217 | func (m *GrilsModule) viewGril(w http.ResponseWriter, r *http.Request, p httprouter.Params) { |