removed parseInt from sorts

v1.18.x
barisusakli 11 years ago
parent 3c8ca63608
commit 6cd84ebe81

@ -46,9 +46,9 @@ module.exports = function(Categories) {
function assignPostsToCategory(category, posts, next) {
category.posts = posts.filter(function(post) {
return parseInt(post.category.cid, 10) === parseInt(category.cid);
return parseInt(post.category.cid, 10) === parseInt(category.cid, 10);
}).sort(function(a, b) {
return parseInt(b.timestamp, 10) - parseInt(a.timestamp, 10);
return b.timestamp - a.timestamp;
}).slice(0, parseInt(category.numRecentReplies, 10));
next();

@ -550,7 +550,7 @@ SocketTopics.searchAndLoadTags = function(socket, data, callback) {
tag.score = results.counts[index];
});
results.tagData.sort(function(a, b) {
return parseInt(b.score, 10) - parseInt(a.score, 10);
return b.score - a.score;
});
callback(null, results.tagData);

@ -66,11 +66,9 @@ module.exports = function(Topics) {
return callback(err);
}
topics.sort(function(a, b) {
return parseInt(b.postcount, 10) - parseInt(a.postcount, 10);
});
topics = topics.slice(0, count).map(function(topic) {
topics = topics.sort(function(a, b) {
return b.postcount - a.postcount;
}).slice(0, count).map(function(topic) {
return topic.tid;
});

@ -108,7 +108,7 @@ var async = require('async'),
}
notifs = notifs.filter(Boolean).sort(function(a, b) {
return parseInt(b.datetime, 10) - parseInt(a.datetime, 10);
return b.datetime - a.datetime;
});
callback(null, notifs);

Loading…
Cancel
Save