From 5d7c0a2a64d1d1681918da46f4e5b5d31876138d Mon Sep 17 00:00:00 2001 From: guru_sainath Date: Thu, 29 Feb 2024 17:19:51 +0530 Subject: [PATCH] [WEB-600] fix: fixed sub-group-by issue count display in kanban layout header (#3843) * fix: fixed subgroupby issue count at the header in kanban layout * chore: code beautification --- .../issues/issue-layouts/kanban/swimlanes.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/components/issues/issue-layouts/kanban/swimlanes.tsx b/web/components/issues/issue-layouts/kanban/swimlanes.tsx index 7b57752f2..1102cdcd6 100644 --- a/web/components/issues/issue-layouts/kanban/swimlanes.tsx +++ b/web/components/issues/issue-layouts/kanban/swimlanes.tsx @@ -30,6 +30,15 @@ interface ISubGroupSwimlaneHeader { kanbanFilters: TIssueKanbanFilters; handleKanbanFilters: (toggle: "group_by" | "sub_group_by", value: string) => void; } + +const getSubGroupHeaderIssuesCount = (issueIds: TSubGroupedIssues, groupById: string) => { + let headerCount = 0; + Object.keys(issueIds).map((groupState) => { + headerCount = headerCount + (issueIds?.[groupState]?.[groupById]?.length || 0); + }); + return headerCount; +}; + const SubGroupSwimlaneHeader: React.FC = ({ issueIds, sub_group_by, @@ -49,7 +58,7 @@ const SubGroupSwimlaneHeader: React.FC = ({ column_id={_list.id} icon={_list.icon} title={_list.name} - count={(issueIds as TGroupedIssues)?.[_list.id]?.length || 0} + count={getSubGroupHeaderIssuesCount(issueIds as TSubGroupedIssues, _list?.id)} kanbanFilters={kanbanFilters} handleKanbanFilters={handleKanbanFilters} issuePayload={_list.payload}