[WEB-1989] chore: archived modules and cycles#5212
[WEB-1989] chore: archived modules and cycles#5212sriramveeraghanta merged 4 commits intopreviewfrom
Conversation
WalkthroughThe changes across several files enhance the project's capability to manage cycle and module data more effectively. New methods and query structures have been introduced to improve how estimates are calculated and displayed for various states of issues. The integration of archived cycle and module details allows for more nuanced data handling, ensuring that both active and archived states are well represented in analytics and reporting. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CycleComponent
participant ModuleComponent
participant DataService
User->>CycleComponent: Change cycle status
CycleComponent->>DataService: fetchCycleDetails() or fetchArchivedCycleDetails()
DataService-->>CycleComponent: Return cycle data
CycleComponent-->>User: Update cycle view
User->>ModuleComponent: Change module status
ModuleComponent->>DataService: fetchModuleDetails() or fetchArchivedModuleDetails()
DataService-->>ModuleComponent: Return module data
ModuleComponent-->>User: Update module view
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
…com:makeplane/plane into fix/estimate_points_archived_cycles_modules
There was a problem hiding this comment.
Actionable comments posted: 6
Outside diff range, codebase verification and nitpick comments (1)
web/core/components/modules/analytics-sidebar/issue-progress.tsx (1)
42-43: Ensure all instances ofuseModulematch the new signatureThe following files contain instances of
useModulethat do not match the updated signature includingfetchArchivedModuleDetails:
space/core/components/issues/issue-layouts/properties/modules.tsxweb/core/layouts/auth-layout/project-wrapper.tsxweb/core/hooks/use-project-issue-properties.tsweb/core/hooks/use-workspace-issue-properties.tsweb/core/components/issues/issue-modal/modal.tsxweb/core/components/modules/module-card-item.tsxweb/core/components/modules/analytics-sidebar/issue-progress.tsxweb/core/components/modules/analytics-sidebar/root.tsxweb/core/components/issues/issue-layouts/kanban/swimlanes.tsxweb/core/components/issues/issue-layouts/kanban/default.tsxweb/core/components/issues/issue-layouts/list/default.tsxweb/core/components/issues/issue-layouts/filters/header/filters/module.tsxweb/core/components/issues/issue-layouts/filters/applied-filters/module.tsxweb/core/components/modules/module-list-item.tsxweb/core/components/modules/delete-module-modal.tsxweb/core/components/modules/quick-actions.tsxweb/core/components/modules/gantt-chart/modules-list-layout.tsxweb/core/components/modules/gantt-chart/blocks.tsxweb/core/components/modules/modal.tsxweb/core/components/modules/archived-modules/view.tsxweb/core/components/modules/archived-modules/modal.tsxweb/core/components/modules/archived-modules/root.tsxweb/core/components/modules/module-list-item-action.tsxweb/core/components/core/sidebar/links-list.tsxweb/core/components/dropdowns/module/module-options.tsxweb/core/components/dropdowns/module/index.tsxweb/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsxweb/core/components/analytics/custom-analytics/sidebar/sidebar.tsxweb/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(list)/page.tsxweb/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(list)/mobile-header.tsxweb/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsxweb/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/mobile-header.tsxweb/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/[moduleId]/page.tsxPlease update these instances to ensure consistency across the codebase.
Analysis chain
LGTM! But verify the function usage in the codebase.
The code changes are approved.
However, ensure that all function calls to
useModulematch the new signature.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `useModule` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type tsx -A 5 $'useModule'Length of output: 58
Script:
#!/bin/bash # Description: Verify all function calls to `useModule` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg 'useModule' -A 5Length of output: 51905
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- apiserver/plane/app/views/cycle/archive.py (7 hunks)
- apiserver/plane/app/views/cycle/base.py (8 hunks)
- apiserver/plane/app/views/module/archive.py (14 hunks)
- apiserver/plane/app/views/module/base.py (2 hunks)
- web/core/components/cycles/analytics-sidebar/issue-progress.tsx (2 hunks)
- web/core/components/modules/analytics-sidebar/issue-progress.tsx (2 hunks)
Additional comments not posted (11)
web/core/components/modules/analytics-sidebar/issue-progress.tsx (1)
104-108: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
fetchArchivedModuleDetailsandfetchModuleDetailsare correctly implemented.Verification successful
Function usage verified
The function calls to
fetchArchivedModuleDetailsandfetchModuleDetailsare correctly implemented across the codebase.
web/core/components/modules/module-peek-overview.tsxweb/core/components/modules/analytics-sidebar/issue-progress.tsxweb/core/components/issues/issue-modal/modal.tsxweb/core/components/analytics/custom-analytics/sidebar/sidebar.tsxweb/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/[moduleId]/page.tsxScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `fetchArchivedModuleDetails` and `fetchModuleDetails` are correctly implemented. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type tsx -A 5 $'fetchArchivedModuleDetails' rg --type tsx -A 5 $'fetchModuleDetails'Length of output: 143
Script:
#!/bin/bash # Description: Verify all function calls to `fetchArchivedModuleDetails` and `fetchModuleDetails` are correctly implemented. # Test: Search for the function usage in .tsx files. Expect: Only occurrences of the new signature. rg --glob '*.tsx' -A 5 'fetchArchivedModuleDetails' rg --glob '*.tsx' -A 5 'fetchModuleDetails'Length of output: 9417
web/core/components/cycles/analytics-sidebar/issue-progress.tsx (2)
119-123: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
fetchArchivedCycleDetailsandfetchCycleDetailsare correctly implemented.Verification successful
Function usage verified
The functions
fetchArchivedCycleDetailsandfetchCycleDetailsare correctly implemented and used across the codebase.
web/core/store/cycle.store.tsweb/core/components/cycles/cycle-peek-overview.tsxweb/core/components/cycles/analytics-sidebar/issue-progress.tsxweb/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/[cycleId]/page.tsxweb/core/components/issues/issue-modal/modal.tsxweb/core/components/cycles/active-cycle/productivity.tsxweb/core/components/analytics/custom-analytics/sidebar/sidebar.tsxScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `fetchArchivedCycleDetails` and `fetchCycleDetails` are correctly implemented. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type tsx -A 5 $'fetchArchivedCycleDetails' rg --type tsx -A 5 $'fetchCycleDetails'Length of output: 141
Script:
#!/bin/bash # Description: Verify all function calls to `fetchArchivedCycleDetails` and `fetchCycleDetails` are correctly implemented. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg -A 5 'fetchArchivedCycleDetails' rg -A 5 'fetchCycleDetails'Length of output: 14321
58-58: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
useCyclematch the new signature.apiserver/plane/app/views/module/archive.py (2)
Line range hint
357-441:
LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
getcorrectly handle the new calculations and response data structure.
106-189: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
get_querysetcorrectly handle the new queries.apiserver/plane/app/views/cycle/archive.py (3)
364-367: Ensure new fields are correctly included in the response data.The new fields
completed_estimate_pointsandtotal_estimate_pointsshould be correctly included in the response data. Verify that these fields are correctly populated.Verification successful
The new fields
completed_estimate_pointsandtotal_estimate_pointsare correctly included in the response data.The search results confirm that these fields are present and being used in the codebase, including in the file
apiserver/plane/app/views/cycle/archive.py.
- File:
apiserver/plane/app/views/cycle/archive.py- Lines: Multiple instances confirming the inclusion of
completed_estimate_pointsandtotal_estimate_points.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that new fields are correctly included in the response data. # Test: Search for new fields in the response data. Expect: Fields should be correctly populated. rg --type python -A 2 $'completed_estimate_points'Length of output: 80
Script:
#!/bin/bash # Description: Verify that new fields are correctly included in the response data. # Test: Search for new fields in the response data. Expect: Fields should be correctly populated. rg 'completed_estimate_points' --glob '*.py' -A 2 rg 'total_estimate_points' --glob '*.py' -A 2Length of output: 12122
255-290: Ensure all subqueries are correctly referenced in annotations.The annotations for estimate points should correctly reference the subqueries defined earlier. Verify that all subqueries are correctly referenced and used.
Verification successful
All subqueries are correctly referenced in the annotations.
The subqueries
backlog_estimate_point,unstarted_estimate_point,started_estimate_point,cancelled_estimate_point,completed_estimate_point, andtotal_estimate_pointare correctly defined and used in the annotations.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all subqueries are correctly referenced in annotations. # Test: Search for subquery references in annotations. Expect: All subqueries should be referenced. rg --type python -A 2 $'Subquery'Length of output: 63
Script:
#!/bin/bash # Description: Verify that all subqueries are correctly referenced in annotations. # Test: Search for subquery definitions and their references in Python files. # Find all Python files and search for subquery definitions fd -e py -x sh -c 'rg -A 2 "Subquery" {}' # Find all Python files and search for the specific subqueries used in the annotations fd -e py -x sh -c 'rg "backlog_estimate_point|unstarted_estimate_point|started_estimate_point|cancelled_estimate_point|completed_estimate_point|total_estimate_point" {}'Length of output: 13921
391-470: Ensure estimate distribution is correctly calculated and included in the response data.The estimate distribution for assignees and labels should be correctly calculated and included in the response data. Verify that the calculations are correct and the data is included.
apiserver/plane/app/views/module/base.py (1)
Line range hint
557-607:
Ensure custom managerIssue.issue_objectsis correctly used.The custom manager
Issue.issue_objectsshould be correctly used to query issues. Verify that the custom manager provides the expected functionality and performance.Verification successful
Custom manager
Issue.issue_objectsis correctly used.The custom manager
Issue.issue_objectsin theretrievemethod correctly applies necessary filters to ensure only relevant issues are included in the queryset. TheIssueManagerclass'sget_querysetmethod provides the expected functionality and performance.
apiserver/plane/db/models/issue.py: Definition and implementation ofIssueManager.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that custom manager `Issue.issue_objects` is correctly used. # Test: Search for custom manager usage in the codebase. Expect: Custom manager should provide the expected functionality and performance. rg --type python -A 5 $'Issue.issue_objects'Length of output: 74
Script:
#!/bin/bash # Description: Verify that custom manager `Issue.issue_objects` is correctly used. # Test: Search for custom manager usage in the codebase. Expect: Custom manager should provide the expected functionality and performance. rg --type py -A 5 $'Issue.issue_objects'Length of output: 83108
Script:
#!/bin/bash # Description: Locate the definition and implementation of `Issue.issue_objects` in the `Issue` model. # Test: Search for the `Issue` model definition and locate `issue_objects` within it. rg --type py -A 10 $'class Issue' | rg 'issue_objects'Length of output: 130
Script:
#!/bin/bash # Description: Locate the definition and implementation of `Issue.issue_objects` in the `Issue` model. # Test: Search for the `issue_objects` definition directly and include more context lines. rg --type py -A 20 'issue_objects'Length of output: 225942
Script:
#!/bin/bash # Description: Locate and display the implementation of the `IssueManager` class. # Test: Search for the `IssueManager` class definition and its implementation. rg --type py -A 20 'class IssueManager'Length of output: 1425
apiserver/plane/app/views/cycle/base.py (2)
Line range hint
836-980:
Ensure custom managerIssue.issue_objectsis correctly used.The custom manager
Issue.issue_objectsshould be correctly used to query issues. Verify that the custom manager provides the expected functionality and performance.Verification successful
Custom manager
Issue.issue_objectsis correctly used.The custom manager
Issue.issue_objectsis consistently used across multiple files and contexts in the codebase, indicating that it provides the expected functionality and performance.
- Files with usage examples:
apiserver/plane/space/utils/grouper.pyapiserver/plane/space/views/inbox.pyapiserver/plane/space/views/issue.pyapiserver/plane/utils/analytics_plot.pyapiserver/plane/bgtasks/issue_automation_task.pyapiserver/plane/app/views/cycle/base.pyapiserver/plane/app/views/module/base.pyapiserver/plane/app/views/dashboard/base.pyThe custom manager appears to be a well-integrated part of the codebase, used in a manner consistent with Django ORM practices.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that custom manager `Issue.issue_objects` is correctly used. # Test: Search for custom manager usage in the codebase. Expect: Custom manager should provide the expected functionality and performance. rg --type python -A 5 $'Issue.issue_objects'Length of output: 74
Script:
#!/bin/bash # Description: Verify that custom manager `Issue.issue_objects` is correctly used. # Test: Search for custom manager usage in the codebase. Expect: Custom manager should provide the expected functionality and performance. rg --type py -A 5 $'Issue.issue_objects'Length of output: 83108
Line range hint
387-467:
Ensure custom managerIssue.issue_objectsis correctly used.The custom manager
Issue.issue_objectsshould be correctly used to query issues. Verify that the custom manager provides the expected functionality and performance.Verification successful
Custom manager
Issue.issue_objectsis correctly used.The custom manager
Issue.issue_objectsis consistently and correctly used across multiple files in the codebase for filtering, annotating, and aggregating data.
- Files with usage:
apiserver/plane/utils/grouper.pyapiserver/plane/utils/analytics_plot.pyapiserver/plane/space/views/inbox.pyapiserver/plane/space/views/issue.pyapiserver/plane/app/views/cycle/archive.pyapiserver/plane/app/views/cycle/base.pyapiserver/plane/app/views/workspace/user.pyapiserver/plane/app/views/view/base.pyapiserver/plane/app/views/workspace/base.pyapiserver/plane/app/views/search/base.pyapiserver/plane/app/views/project/base.pyapiserver/plane/app/views/module/archive.pyapiserver/plane/app/views/issue/base.pyapiserver/plane/app/views/module/base.pyapiserver/plane/app/views/issue/relation.pyapiserver/plane/app/views/inbox/base.pyapiserver/plane/app/views/issue/draft.pyapiserver/plane/app/views/issue/sub_issue.pyapiserver/plane/app/views/analytic/base.pyapiserver/plane/bgtasks/issue_automation_task.pyapiserver/plane/app/views/module/issue.pyapiserver/plane/bgtasks/analytic_plot_export.pyapiserver/plane/app/views/dashboard/base.pyapiserver/plane/api/views/module.pyapiserver/plane/api/views/state.pyapiserver/plane/api/views/cycle.pyapiserver/plane/api/views/issue.pyScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that custom manager `Issue.issue_objects` is correctly used. # Test: Search for custom manager usage in the codebase. Expect: Custom manager should provide the expected functionality and performance. rg --type python -A 5 $'Issue.issue_objects'Length of output: 74
Script:
#!/bin/bash # Description: Verify that custom manager `Issue.issue_objects` is correctly used. # Test: Search for custom manager usage in the codebase. Expect: Custom manager should provide the expected functionality and performance. rg --type py -A 5 'Issue.issue_objects'Length of output: 83108
| unstarted_estimate_point = ( | ||
| Issue.issue_objects.filter( | ||
| estimate_point__estimate__type="points", | ||
| state__group="unstarted", | ||
| issue_cycle__cycle_id=OuterRef("pk"), | ||
| ) | ||
| .values("issue_cycle__cycle_id") | ||
| .annotate( | ||
| unstarted_estimate_point=Sum( | ||
| Cast("estimate_point__value", FloatField()) | ||
| ) | ||
| ) | ||
| .values("unstarted_estimate_point")[:1] | ||
| ) |
There was a problem hiding this comment.
Enhance readability by extracting subquery logic into a helper function.
The subquery logic for calculating unstarted_estimate_point is repeated for other states. Extracting this logic into a helper function can improve readability and maintainability.
unstarted_estimate_point = get_estimate_point_subquery("unstarted")| started_estimate_point = ( | ||
| Issue.issue_objects.filter( | ||
| estimate_point__estimate__type="points", | ||
| state__group="started", | ||
| issue_cycle__cycle_id=OuterRef("pk"), | ||
| ) | ||
| .values("issue_cycle__cycle_id") | ||
| .annotate( | ||
| started_estimate_point=Sum( | ||
| Cast("estimate_point__value", FloatField()) | ||
| ) | ||
| ) | ||
| .values("started_estimate_point")[:1] | ||
| ) |
There was a problem hiding this comment.
Enhance readability by extracting subquery logic into a helper function.
The subquery logic for calculating started_estimate_point is repeated for other states. Extracting this logic into a helper function can improve readability and maintainability.
started_estimate_point = get_estimate_point_subquery("started")| cancelled_estimate_point = ( | ||
| Issue.issue_objects.filter( | ||
| estimate_point__estimate__type="points", | ||
| state__group="cancelled", | ||
| issue_cycle__cycle_id=OuterRef("pk"), | ||
| ) | ||
| .values("issue_cycle__cycle_id") | ||
| .annotate( | ||
| cancelled_estimate_point=Sum( | ||
| Cast("estimate_point__value", FloatField()) | ||
| ) | ||
| ) | ||
| .values("cancelled_estimate_point")[:1] | ||
| ) |
There was a problem hiding this comment.
Enhance readability by extracting subquery logic into a helper function.
The subquery logic for calculating cancelled_estimate_point is repeated for other states. Extracting this logic into a helper function can improve readability and maintainability.
cancelled_estimate_point = get_estimate_point_subquery("cancelled")| completed_estimate_point = ( | ||
| Issue.issue_objects.filter( | ||
| estimate_point__estimate__type="points", | ||
| state__group="completed", | ||
| issue_cycle__cycle_id=OuterRef("pk"), | ||
| ) | ||
| .values("issue_cycle__cycle_id") | ||
| .annotate( | ||
| completed_estimate_points=Sum( | ||
| Cast("estimate_point__value", FloatField()) | ||
| ) | ||
| ) | ||
| .values("completed_estimate_points")[:1] | ||
| ) |
There was a problem hiding this comment.
Enhance readability by extracting subquery logic into a helper function.
The subquery logic for calculating completed_estimate_point is repeated for other states. Extracting this logic into a helper function can improve readability and maintainability.
completed_estimate_point = get_estimate_point_subquery("completed")| total_estimate_point = ( | ||
| Issue.issue_objects.filter( | ||
| estimate_point__estimate__type="points", | ||
| issue_cycle__cycle_id=OuterRef("pk"), | ||
| ) | ||
| .values("issue_cycle__cycle_id") | ||
| .annotate( | ||
| total_estimate_points=Sum( | ||
| Cast("estimate_point__value", FloatField()) | ||
| ) | ||
| ) | ||
| .values("total_estimate_points")[:1] |
There was a problem hiding this comment.
Enhance readability by extracting subquery logic into a helper function.
The subquery logic for calculating total_estimate_point is repeated for other states. Extracting this logic into a helper function can improve readability and maintainability.
total_estimate_point = get_estimate_point_subquery(None)
Issue Link: WEB-1989
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Documentation