fixed mysql null reference in trending query

This commit is contained in:
bill bittner 2017-07-27 21:40:22 -07:00
parent e3aa9db329
commit 5ea7d959b9

View file

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