Don't count estimate for moderation queue

This commit is contained in:
Las Zenow 2021-05-07 07:51:57 +00:00
parent 70d032e181
commit 1bfb377174

View file

@ -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
} }