Now dividing total rows by entries/page for actual page count.
This commit is contained in:
parent
7fff166c3e
commit
07b4dfe14b
|
@ -26,14 +26,17 @@ export default function searcher(table, matchField=undefined, matchQuery=undefin
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
const pageCount =
|
const pageCount =
|
||||||
method === "get" ? 0 :
|
method === "get" ? 0 :
|
||||||
sqlite
|
Math.ceil(
|
||||||
.prepare(`
|
sqlite
|
||||||
SELECT count(*) FROM ${simpleSanitize(table)}
|
.prepare(`
|
||||||
${matchField ? `WHERE ${simpleSanitize(matchField)} = $matchQuery` : ""}
|
SELECT count(*) FROM ${simpleSanitize(table)}
|
||||||
`)
|
${matchField ? `WHERE ${simpleSanitize(matchField)} = $matchQuery` : ""}
|
||||||
.get({
|
`)
|
||||||
matchQuery
|
.get({
|
||||||
})['count(*)']
|
matchQuery
|
||||||
|
})['count(*)']
|
||||||
|
/ entriesPerPage
|
||||||
|
)
|
||||||
|
|
||||||
if (method === "all" && page > pageCount)
|
if (method === "all" && page > pageCount)
|
||||||
reject(`Page number too high! Page count: ${pageCount}`)
|
reject(`Page number too high! Page count: ${pageCount}`)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user