Skip to content

Commit

Permalink
logs-removed
Browse files Browse the repository at this point in the history
  • Loading branch information
SURAJ-SHARMA27 committed Aug 13, 2024
1 parent 57202bf commit bc6e5b9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/shared/components/plots/MultipleCategoryBarPlotUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,13 @@ export function getSortedMajorCategories(

data.forEach(item => {
item.counts.forEach(countItem => {
const { majorCategory, count } = countItem;
const { majorCategory, percentage, count } = countItem;
if (!majorCategoryCounts[majorCategory]) {
majorCategoryCounts[majorCategory] = 0;
}
majorCategoryCounts[majorCategory] += count;
});
});
console.log(majorCategoryCounts, 'this is major');
return Object.keys(majorCategoryCounts).sort(
(a, b) => majorCategoryCounts[b] - majorCategoryCounts[a]
);
Expand All @@ -131,7 +130,7 @@ export function getSortedMajorCategories(
item => item.minorCategory === sortByOption
);
if (sortedEntityData) {
sortedEntityData.counts.sort((a, b) => b.count - a.count);
sortedEntityData.counts.sort((a, b) => b.percentage - a.percentage);

return sortedEntityData.counts.map(item => item.majorCategory);
}
Expand All @@ -147,7 +146,6 @@ export function sortDataByOption(

if (sortByOption === 'SortByTotalSum' || sortedMajorCategories.length > 0) {
const reorderCounts = (counts: CountItem[]): CountItem[] => {
console.log('Counts structure:', counts);
return sortedMajorCategories
.map(category =>
counts.find(
Expand Down

0 comments on commit bc6e5b9

Please sign in to comment.