Fix prepare statements and inconsistencies

This commit is contained in:
Nanobyte
2021-05-07 02:01:49 +02:00
parent 78a7f8a207
commit 1122681c4f
4 changed files with 5 additions and 5 deletions

View File

@@ -304,7 +304,7 @@ export async function voteOnSponsorTime(req: Request, res: Response) {
const MILLISECONDS_IN_HOUR = 3600000;
const now = Date.now();
const warningsCount = (await db.prepare('get', `SELECT count(1) as count FROM warnings WHERE "userID" = ? AND "issueTime" > ? AND enabled = 1`,
const warningsCount = (await db.prepare('get', `SELECT count(*) as count FROM warnings WHERE "userID" = ? AND "issueTime" > ? AND enabled = 1`,
[nonAnonUserID, Math.floor(now - (config.hoursAfterWarningExpires * MILLISECONDS_IN_HOUR))],
)).count;