-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WEB-1989] chore: archived modules and cycles #5212
[WEB-1989] chore: archived modules and cycles #5212
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ofuseModule
match the new signatureThe following files contain instances of
useModule
that do not match the updated signature includingfetchArchivedModuleDetails
:
space/core/components/issues/issue-layouts/properties/modules.tsx
web/core/layouts/auth-layout/project-wrapper.tsx
web/core/hooks/use-project-issue-properties.ts
web/core/hooks/use-workspace-issue-properties.ts
web/core/components/issues/issue-modal/modal.tsx
web/core/components/modules/module-card-item.tsx
web/core/components/modules/analytics-sidebar/issue-progress.tsx
web/core/components/modules/analytics-sidebar/root.tsx
web/core/components/issues/issue-layouts/kanban/swimlanes.tsx
web/core/components/issues/issue-layouts/kanban/default.tsx
web/core/components/issues/issue-layouts/list/default.tsx
web/core/components/issues/issue-layouts/filters/header/filters/module.tsx
web/core/components/issues/issue-layouts/filters/applied-filters/module.tsx
web/core/components/modules/module-list-item.tsx
web/core/components/modules/delete-module-modal.tsx
web/core/components/modules/quick-actions.tsx
web/core/components/modules/gantt-chart/modules-list-layout.tsx
web/core/components/modules/gantt-chart/blocks.tsx
web/core/components/modules/modal.tsx
web/core/components/modules/archived-modules/view.tsx
web/core/components/modules/archived-modules/modal.tsx
web/core/components/modules/archived-modules/root.tsx
web/core/components/modules/module-list-item-action.tsx
web/core/components/core/sidebar/links-list.tsx
web/core/components/dropdowns/module/module-options.tsx
web/core/components/dropdowns/module/index.tsx
web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx
web/core/components/analytics/custom-analytics/sidebar/sidebar.tsx
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(list)/page.tsx
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(list)/mobile-header.tsx
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/mobile-header.tsx
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/[moduleId]/page.tsx
Please 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
useModule
match 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
fetchArchivedModuleDetails
andfetchModuleDetails
are correctly implemented.Verification successful
Function usage verified
The function calls to
fetchArchivedModuleDetails
andfetchModuleDetails
are correctly implemented across the codebase.
web/core/components/modules/module-peek-overview.tsx
web/core/components/modules/analytics-sidebar/issue-progress.tsx
web/core/components/issues/issue-modal/modal.tsx
web/core/components/analytics/custom-analytics/sidebar/sidebar.tsx
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/[moduleId]/page.tsx
Scripts 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
fetchArchivedCycleDetails
andfetchCycleDetails
are correctly implemented.Verification successful
Function usage verified
The functions
fetchArchivedCycleDetails
andfetchCycleDetails
are correctly implemented and used across the codebase.
web/core/store/cycle.store.ts
web/core/components/cycles/cycle-peek-overview.tsx
web/core/components/cycles/analytics-sidebar/issue-progress.tsx
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/[cycleId]/page.tsx
web/core/components/issues/issue-modal/modal.tsx
web/core/components/cycles/active-cycle/productivity.tsx
web/core/components/analytics/custom-analytics/sidebar/sidebar.tsx
Scripts 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
useCycle
match 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
get
correctly 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_queryset
correctly 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_points
andtotal_estimate_points
should be correctly included in the response data. Verify that these fields are correctly populated.Verification successful
The new fields
completed_estimate_points
andtotal_estimate_points
are 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_points
andtotal_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_point
are 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_objects
is correctly used.The custom manager
Issue.issue_objects
should be correctly used to query issues. Verify that the custom manager provides the expected functionality and performance.Verification successful
Custom manager
Issue.issue_objects
is correctly used.The custom manager
Issue.issue_objects
in theretrieve
method correctly applies necessary filters to ensure only relevant issues are included in the queryset. TheIssueManager
class'sget_queryset
method 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_objects
is correctly used.The custom manager
Issue.issue_objects
should be correctly used to query issues. Verify that the custom manager provides the expected functionality and performance.Verification successful
Custom manager
Issue.issue_objects
is correctly used.The custom manager
Issue.issue_objects
is 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.py
apiserver/plane/space/views/inbox.py
apiserver/plane/space/views/issue.py
apiserver/plane/utils/analytics_plot.py
apiserver/plane/bgtasks/issue_automation_task.py
apiserver/plane/app/views/cycle/base.py
apiserver/plane/app/views/module/base.py
apiserver/plane/app/views/dashboard/base.py
The 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_objects
is correctly used.The custom manager
Issue.issue_objects
should be correctly used to query issues. Verify that the custom manager provides the expected functionality and performance.Verification successful
Custom manager
Issue.issue_objects
is correctly used.The custom manager
Issue.issue_objects
is consistently and correctly used across multiple files in the codebase for filtering, annotating, and aggregating data.
- Files with usage:
apiserver/plane/utils/grouper.py
apiserver/plane/utils/analytics_plot.py
apiserver/plane/space/views/inbox.py
apiserver/plane/space/views/issue.py
apiserver/plane/app/views/cycle/archive.py
apiserver/plane/app/views/cycle/base.py
apiserver/plane/app/views/workspace/user.py
apiserver/plane/app/views/view/base.py
apiserver/plane/app/views/workspace/base.py
apiserver/plane/app/views/search/base.py
apiserver/plane/app/views/project/base.py
apiserver/plane/app/views/module/archive.py
apiserver/plane/app/views/issue/base.py
apiserver/plane/app/views/module/base.py
apiserver/plane/app/views/issue/relation.py
apiserver/plane/app/views/inbox/base.py
apiserver/plane/app/views/issue/draft.py
apiserver/plane/app/views/issue/sub_issue.py
apiserver/plane/app/views/analytic/base.py
apiserver/plane/bgtasks/issue_automation_task.py
apiserver/plane/app/views/module/issue.py
apiserver/plane/bgtasks/analytic_plot_export.py
apiserver/plane/app/views/dashboard/base.py
apiserver/plane/api/views/module.py
apiserver/plane/api/views/state.py
apiserver/plane/api/views/cycle.py
apiserver/plane/api/views/issue.py
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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