fix: topic counts were not included in normalised data.

This commit is contained in:
Kshitij Sobti
2021-12-10 00:33:05 +05:30
parent 0646d717ea
commit 9c7be068ac
2 changed files with 4 additions and 4 deletions

View File

@@ -11,13 +11,13 @@ function normaliseTopics(data) {
const categoryIds = [];
data.coursewareTopics.forEach(category => {
topicsInCategory[category.name] = category.children.map(topic => {
topics[topic.id] = { id: topic.id, name: topic.name, categoryId: category.name };
topics[topic.id] = { ...topic, categoryId: category.name };
return topic.id;
});
categoryIds.push(category.name);
});
const nonCoursewareIds = data.nonCoursewareTopics.map(topic => {
topics[topic.id] = { id: topic.id, name: topic.name };
topics[topic.id] = topic;
return topic.id;
});
return {

View File

@@ -21,12 +21,12 @@ function Topic({ topic }) {
{
key: 'discussions',
icon: PostIcon,
count: topic?.threadCounts?.discussions || 0,
count: topic.threadCounts?.discussion || 0,
},
{
key: 'questions',
icon: Help,
count: topic?.threadCounts?.questions || 0,
count: topic.threadCounts?.question || 0,
},
];
return (