From a3d99100ee04dd4cddeb2e7a4344d1f72d01154b Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:05:13 +0530 Subject: [PATCH] fix: sub issue progress indicator fix (#1847) --- apps/app/components/issues/sub-issues-list.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/app/components/issues/sub-issues-list.tsx b/apps/app/components/issues/sub-issues-list.tsx index 7d526d661..9ba920ff5 100644 --- a/apps/app/components/issues/sub-issues-list.tsx +++ b/apps/app/components/issues/sub-issues-list.tsx @@ -93,13 +93,14 @@ export const SubIssuesList: FC = ({ parentIssue, user, disabled = false } }); }; - const completedSubIssues = subIssuesResponse - ? subIssuesResponse.state_distribution.completed + - subIssuesResponse.state_distribution.cancelled - : 0; + const completedSubIssue = subIssuesResponse?.state_distribution.completed ?? 0; + const cancelledSubIssue = subIssuesResponse?.state_distribution.cancelled ?? 0; + + const totalCompletedSubIssues = completedSubIssue + cancelledSubIssue; + const totalSubIssues = subIssuesResponse ? subIssuesResponse.sub_issues.length : 0; - const completionPercentage = (completedSubIssues / totalSubIssues) * 100; + const completionPercentage = (totalCompletedSubIssues / totalSubIssues) * 100; const isNotAllowed = memberRole.isGuest || memberRole.isViewer || disabled;