Skip to content

Commit

Permalink
feat: remove sort again
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Apr 8, 2021
1 parent 2dc3283 commit fd3bc60
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/topics/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,13 @@ module.exports = function (Topics) {
};

Topics.getTopicTags = async function (tid) {
const tags = await db.getSetMembers(`topic:${tid}:tags`);
return tags.sort();
return await db.getSetMembers(`topic:${tid}:tags`);
};

Topics.getTopicsTags = async function (tids) {
const keys = tids.map(tid => `topic:${tid}:tags`);
const tags = await db.getSetsMembers(keys);
tags.forEach(tags => tags.sort());
return tags;
return await db.getSetsMembers(
tids.map(tid => `topic:${tid}:tags`)
);
};

Topics.getTopicTagsObjects = async function (tid) {
Expand All @@ -317,7 +315,6 @@ module.exports = function (Topics) {
topicTags.forEach((tags, index) => {
if (Array.isArray(tags)) {
topicTags[index] = tags.map(tag => tagDataMap[tag]);
topicTags[index].sort((tag1, tag2) => tag2.value - tag1.value);
}
});

Expand Down

0 comments on commit fd3bc60

Please sign in to comment.