Don't count estimate for moderation queue
This commit is contained in:
parent
70d032e181
commit
1bfb377174
1 changed files with 7 additions and 3 deletions
|
@ -85,12 +85,16 @@ func (db *pgDB) getBooks(active bool, query string, length int, start int) (book
|
||||||
order = strings.Join(rank, "+") + " DESC, upload_date DESC"
|
order = strings.Join(rank, "+") + " DESC, upload_date DESC"
|
||||||
}
|
}
|
||||||
|
|
||||||
num, err = db.sql.Model(&books).
|
q := db.sql.Model(&books).
|
||||||
Where(searchCondition, searchParams...).
|
Where(searchCondition, searchParams...).
|
||||||
OrderExpr(order, rankParams...).
|
OrderExpr(order, rankParams...).
|
||||||
Offset(start).
|
Offset(start).
|
||||||
Limit(length).
|
Limit(length)
|
||||||
SelectAndCountEstimate(1000)
|
if active {
|
||||||
|
num, err = q.SelectAndCountEstimate(1000)
|
||||||
|
} else {
|
||||||
|
num, err = q.SelectAndCount()
|
||||||
|
}
|
||||||
return books, num, err
|
return books, num, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue