fix empty search query bug
Cette révision appartient à :
Parent
db35ce27ff
révision
47384c6d21
1 fichiers modifiés avec 4 ajouts et 2 suppressions
|
@ -6,8 +6,8 @@ import (
|
||||||
"github.com/ewhal/nyaa/db"
|
"github.com/ewhal/nyaa/db"
|
||||||
"github.com/ewhal/nyaa/model"
|
"github.com/ewhal/nyaa/model"
|
||||||
"github.com/ewhal/nyaa/util"
|
"github.com/ewhal/nyaa/util"
|
||||||
"strings"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type WhereParams struct {
|
type WhereParams struct {
|
||||||
|
@ -64,7 +64,9 @@ func GetTorrentsOrderBy(parameters *WhereParams, orderBy string, limit int, offs
|
||||||
|
|
||||||
var params []interface{}
|
var params []interface{}
|
||||||
if parameters != nil { // if there is where parameters
|
if parameters != nil { // if there is where parameters
|
||||||
conditions += " AND " + parameters.Conditions
|
if len(parameters.Conditions) > 0 {
|
||||||
|
conditions += " AND " + parameters.Conditions
|
||||||
|
}
|
||||||
params = parameters.Params
|
params = parameters.Params
|
||||||
}
|
}
|
||||||
db.ORM.Model(&torrents).Where(conditions, params...).Count(&count)
|
db.ORM.Model(&torrents).Where(conditions, params...).Count(&count)
|
||||||
|
|
Référencer dans un nouveau ticket