mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
removed parseInt from sorts
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user