From bc6e5b99bfaf548fd73e5ea42f471704f4d2490b Mon Sep 17 00:00:00 2001 From: suraj Date: Tue, 13 Aug 2024 23:21:24 +0530 Subject: [PATCH] logs-removed --- src/shared/components/plots/MultipleCategoryBarPlotUtils.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/shared/components/plots/MultipleCategoryBarPlotUtils.ts b/src/shared/components/plots/MultipleCategoryBarPlotUtils.ts index 28ce6cdc410..652171a0a43 100644 --- a/src/shared/components/plots/MultipleCategoryBarPlotUtils.ts +++ b/src/shared/components/plots/MultipleCategoryBarPlotUtils.ts @@ -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] ); @@ -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); } @@ -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(