[WEB-1145] chore: updated sub issue count in cycles, modules and project (#4328)

* chore: total issue count

* chore: removed the migration file

* fix: issue count

---------

Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>
This commit is contained in:
Bavisetti Narayan 2024-05-01 18:24:54 +05:30 committed by GitHub
parent eb0877a3c8
commit efa3eda85e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 12 additions and 19 deletions

View File

@ -185,7 +185,6 @@ class ProjectViewSet(WebhookMixin, BaseViewSet):
.annotate( .annotate(
total_issues=Issue.issue_objects.filter( total_issues=Issue.issue_objects.filter(
project_id=self.kwargs.get("pk"), project_id=self.kwargs.get("pk"),
parent__isnull=True,
) )
.order_by() .order_by()
.annotate(count=Func(F("id"), function="Count")) .annotate(count=Func(F("id"), function="Count"))
@ -204,7 +203,6 @@ class ProjectViewSet(WebhookMixin, BaseViewSet):
archived_issues=Issue.objects.filter( archived_issues=Issue.objects.filter(
project_id=self.kwargs.get("pk"), project_id=self.kwargs.get("pk"),
archived_at__isnull=False, archived_at__isnull=False,
parent__isnull=True,
) )
.order_by() .order_by()
.annotate(count=Func(F("id"), function="Count")) .annotate(count=Func(F("id"), function="Count"))
@ -224,7 +222,6 @@ class ProjectViewSet(WebhookMixin, BaseViewSet):
draft_issues=Issue.objects.filter( draft_issues=Issue.objects.filter(
project_id=self.kwargs.get("pk"), project_id=self.kwargs.get("pk"),
is_draft=True, is_draft=True,
parent__isnull=True,
) )
.order_by() .order_by()
.annotate(count=Func(F("id"), function="Count")) .annotate(count=Func(F("id"), function="Count"))

View File

@ -147,8 +147,8 @@ export const CycleIssuesHeader: React.FC = observer(() => {
currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole); currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole);
const issueCount = cycleDetails const issueCount = cycleDetails
? issueFilters?.displayFilters?.sub_issue && cycleDetails?.sub_issues ? !issueFilters?.displayFilters?.sub_issue && cycleDetails?.sub_issues
? cycleDetails.total_issues + cycleDetails?.sub_issues ? cycleDetails.total_issues - cycleDetails?.sub_issues
: cycleDetails.total_issues : cycleDetails.total_issues
: undefined; : undefined;
@ -227,9 +227,7 @@ export const CycleIssuesHeader: React.FC = observer(() => {
className="ml-1.5 flex-shrink-0 truncate" className="ml-1.5 flex-shrink-0 truncate"
placement="bottom-start" placement="bottom-start"
> >
{currentProjectCycleIds?.map((cycleId) => ( {currentProjectCycleIds?.map((cycleId) => <CycleDropdownOption key={cycleId} cycleId={cycleId} />)}
<CycleDropdownOption key={cycleId} cycleId={cycleId} />
))}
</CustomMenu> </CustomMenu>
} }
/> />

View File

@ -147,8 +147,8 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole); currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole);
const issueCount = moduleDetails const issueCount = moduleDetails
? issueFilters?.displayFilters?.sub_issue && moduleDetails.sub_issues ? !issueFilters?.displayFilters?.sub_issue && moduleDetails.sub_issues
? moduleDetails.total_issues + moduleDetails.sub_issues ? moduleDetails.total_issues - moduleDetails.sub_issues
: moduleDetails.total_issues : moduleDetails.total_issues
: undefined; : undefined;
@ -227,9 +227,7 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
className="ml-1.5 flex-shrink-0" className="ml-1.5 flex-shrink-0"
placement="bottom-start" placement="bottom-start"
> >
{projectModuleIds?.map((moduleId) => ( {projectModuleIds?.map((moduleId) => <ModuleDropdownOption key={moduleId} moduleId={moduleId} />)}
<ModuleDropdownOption key={moduleId} moduleId={moduleId} />
))}
</CustomMenu> </CustomMenu>
} }
/> />

View File

@ -27,8 +27,8 @@ export const ProjectArchivesHeader: FC = observer(() => {
const { isMobile } = usePlatformOS(); const { isMobile } = usePlatformOS();
const issueCount = currentProjectDetails const issueCount = currentProjectDetails
? issueFilters?.displayFilters?.sub_issue ? !issueFilters?.displayFilters?.sub_issue && currentProjectDetails.archived_sub_issues
? currentProjectDetails.archived_issues + currentProjectDetails.archived_sub_issues ? currentProjectDetails.archived_issues - currentProjectDetails.archived_sub_issues
: currentProjectDetails.archived_issues : currentProjectDetails.archived_issues
: undefined; : undefined;

View File

@ -78,8 +78,8 @@ export const ProjectDraftIssueHeader: FC = observer(() => {
); );
const issueCount = currentProjectDetails const issueCount = currentProjectDetails
? issueFilters?.displayFilters?.sub_issue ? !issueFilters?.displayFilters?.sub_issue && currentProjectDetails.draft_sub_issues
? currentProjectDetails.draft_issues + currentProjectDetails.draft_sub_issues ? currentProjectDetails.draft_issues - currentProjectDetails.draft_sub_issues
: currentProjectDetails.draft_issues : currentProjectDetails.draft_issues
: undefined; : undefined;

View File

@ -104,8 +104,8 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole); currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole);
const issueCount = currentProjectDetails const issueCount = currentProjectDetails
? issueFilters?.displayFilters?.sub_issue ? !issueFilters?.displayFilters?.sub_issue && currentProjectDetails?.sub_issues
? currentProjectDetails?.total_issues + currentProjectDetails?.sub_issues ? currentProjectDetails?.total_issues - currentProjectDetails?.sub_issues
: currentProjectDetails?.total_issues : currentProjectDetails?.total_issues
: undefined; : undefined;