From 5ea7d959b9d960ef10000885a9867df477a0daf0 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 27 Jul 2017 21:40:22 -0700 Subject: [PATCH] fixed mysql null reference in trending query --- controllers/statsController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/statsController.js b/controllers/statsController.js index 540ebc9a..e9593c4b 100644 --- a/controllers/statsController.js +++ b/controllers/statsController.js @@ -147,7 +147,7 @@ module.exports = { const deferred = new Promise((resolve, reject) => { // get the raw requests data db.sequelize - .query('SELECT COUNT(*), File.* FROM Request LEFT JOIN File ON Request.FileId = File.id WHERE FileId != "null" AND nsfw != 1 AND trendingEligible = 1 GROUP BY FileId ORDER BY COUNT(*) DESC LIMIT 25;', { type: db.sequelize.QueryTypes.SELECT }) + .query('SELECT COUNT(*), File.* FROM Request LEFT JOIN File ON Request.FileId = File.id WHERE FileId IS NOT NULL AND nsfw != 1 AND trendingEligible = 1 GROUP BY FileId ORDER BY COUNT(*) DESC LIMIT 25;', { type: db.sequelize.QueryTypes.SELECT }) .then(results => { resolve(results); })