From 032066260b8c71e7ba4d14e3b757770f552318ae Mon Sep 17 00:00:00 2001 From: bill bittner Date: Wed, 26 Jul 2017 16:24:50 -0700 Subject: [PATCH] added 'trendingEligible' column in file db --- controllers/statsController.js | 2 +- models/file.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/controllers/statsController.js b/controllers/statsController.js index 49516265..540ebc9a 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 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 != "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); }) diff --git a/models/file.js b/models/file.js index 5c8ff364..faabf142 100644 --- a/models/file.js +++ b/models/file.js @@ -39,6 +39,11 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER }) => { allowNull : false, defaultValue: false, }, + trendingEligible: { + type : BOOLEAN, + allowNull : false, + defaultValue: true, + }, }, { freezeTableName: true,