renamed end to stop globally

fixed getting favourites for admins
This commit is contained in:
barisusakli
2015-03-31 23:40:58 -04:00
parent 27bab3330a
commit 878e548296
26 changed files with 160 additions and 166 deletions

View File

@@ -14,32 +14,32 @@ module.exports = function(Topics) {
year: 31104000000
};
Topics.getLatestTopics = function(uid, start, end, term, callback) {
Topics.getLatestTopics = function(uid, start, stop, term, callback) {
async.waterfall([
function (next) {
Topics.getLatestTidsFromSet('topics:recent', start, end, term, next);
Topics.getLatestTidsFromSet('topics:recent', start, stop, term, next);
},
function(tids, next) {
Topics.getTopics(tids, uid, next);
},
function(topics, next) {
next(null, {topics: topics, nextStart: end + 1});
next(null, {topics: topics, nextStart: stop + 1});
}
], callback);
};
Topics.getLatestTids = function(start, end, term, callback) {
Topics.getLatestTids = function(start, stop, term, callback) {
winston.warn('[deprecation warning] please use Topics.getLatestTidsFromSet("topics:recent")');
Topics.getLatestTidsFromSet('topics:recent', start, end, term, callback);
Topics.getLatestTidsFromSet('topics:recent', start, stop, term, callback);
};
Topics.getLatestTidsFromSet = function(set, start, end, term, callback) {
Topics.getLatestTidsFromSet = function(set, start, stop, term, callback) {
var since = terms.day;
if (terms[term]) {
since = terms[term];
}
var count = parseInt(end, 10) === -1 ? end : end - start + 1;
var count = parseInt(stop, 10) === -1 ? stop : stop - start + 1;
db.getSortedSetRevRangeByScore(set, start, count, '+inf', Date.now() - since, callback);
};