-
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-3102]fix: transfer issues count #6384
Conversation
WalkthroughThe pull request introduces a comprehensive update to how pending issues are tracked and displayed across the Plane application. The changes span multiple components and files, focusing on replacing the manual calculation of transferable issues with a direct Changes
Sequence DiagramsequenceDiagram
participant API as API Server
participant Frontend as Frontend Components
participant Cycle as Cycle Management
API->>API: Annotate cycles with pending_issues
Frontend->>API: Request cycle list
API-->>Frontend: Return cycles with pending_issues
Frontend->>Cycle: Render transfer issues UI
Cycle->>Frontend: Display pending issues count
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 0
🧹 Nitpick comments (1)
web/core/components/cycles/list/cycle-list-item-action.tsx (1)
84-88
: LGTM! Consider extracting the calculation to a utility function.The calculation correctly accounts for cancelled issues and is consistent with the implementation in quick-actions.tsx.
Since this calculation is used in multiple components, consider extracting it to a utility function:
+// utils/cycle.ts +export const getTransferableIssuesCount = (cycle: ICycle): number => + cycle ? cycle.total_issues - cycle.completed_issues - (cycle.progress_snapshot?.cancelled_issues || 0) : 0; -const transferableIssuesCount = cycleDetails - ? cycleDetails.total_issues - - cycleDetails.completed_issues - - (cycleDetails.progress_snapshot?.cancelled_issues || 0) - : 0; +const transferableIssuesCount = getTransferableIssuesCount(cycleDetails);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
web/core/components/cycles/list/cycle-list-item-action.tsx
(1 hunks)web/core/components/cycles/quick-actions.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (1)
web/core/components/cycles/quick-actions.tsx (1)
45-49
: LGTM! Verify the impact on cycle transfers.The calculation now correctly accounts for cancelled issues using safe access patterns. This provides a more accurate count of transferable issues.
Let's verify the usage of this transferable count:
✅ Verification successful
Verified: The transferable issues count change is safe
The count is used as a prop in the EndCycleModal component and doesn't affect the actual transfer functionality implemented in TransferIssuesModal. The improved calculation provides a more accurate representation of transferable issues by excluding cancelled ones.
Note: There's a spelling inconsistency between "transferable" and "transferrable" in the codebase that might be worth standardizing in a future update.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for components using transferableIssuesCount rg -l "transferableIssuesCount|transferrableIssuesCount" --type tsx # Search for any cycle transfer related functionality ast-grep --pattern 'function $FUNC($ARGS) { $$$ transfer $$$ }'Length of output: 169
Script:
#!/bin/bash # Search with correct file type and both spelling variants rg -t ts -t tsx "transfer(r)?ableIssuesCount" -l # Search for cycle transfer related code with context rg -t ts -t tsx "(endCycle|transferIssues|moveToCycle)" -B 2 -A 2 # Look for modal components that might use the count fd -e tsx -e ts "modal" --exec grep -l "Issues"Length of output: 875
Script:
#!/bin/bash # Check content of cycle-related modal components cat "./web/ce/components/cycles/end-cycle/modal.tsx" "./web/core/components/cycles/transfer-issues-modal.tsx" # Search for transfer-related code in these specific files rg "transfer" "./web/ce/components/cycles/end-cycle/modal.tsx" "./web/core/components/cycles/transfer-issues-modal.tsx" # Look for the count variable usage rg "Issues(Count|Number)" "./web/ce/components/cycles/end-cycle/modal.tsx" "./web/core/components/cycles/transfer-issues-modal.tsx"Length of output: 9013
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: 0
🧹 Nitpick comments (1)
web/core/store/cycle.store.ts (1)
371-381
: Consider improving readability with early return.The implementation correctly calculates pending issues by including cancelled issues in the calculation. However, the code can be made more readable with an early return pattern.
Here's a suggested improvement:
getPendingIssueCount = (cycleId: string) => { - let pending_issues = 0; const cycleDetails = this.cycleMap[cycleId]; - if (!cycleDetails) return pending_issues; + if (!cycleDetails) return 0; - pending_issues = - cycleDetails.total_issues - - cycleDetails.completed_issues - - (cycleDetails.progress_snapshot?.cancelled_issues || 0); - - return pending_issues; + return cycleDetails.total_issues - + cycleDetails.completed_issues - + (cycleDetails.progress_snapshot?.cancelled_issues || 0); };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
web/core/components/cycles/list/cycle-list-item-action.tsx
(2 hunks)web/core/components/cycles/quick-actions.tsx
(1 hunks)web/core/store/cycle.store.ts
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- web/core/components/cycles/list/cycle-list-item-action.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (3)
web/core/store/cycle.store.ts (1)
59-59
: LGTM!The method signature is correctly added to the interface.
web/core/components/cycles/quick-actions.tsx (2)
39-39
: LGTM!The hook destructuring is correctly updated to include the new
getPendingIssueCount
method.
45-45
: LGTM!The calculation of
transferableIssuesCount
is correctly updated to use the newgetPendingIssueCount
method, which includes cancelled issues in the calculation.
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: 0
🧹 Nitpick comments (2)
apiserver/plane/app/views/cycle/base.py (2)
140-140
: Fix line length to comply with PEP 8.The line exceeds the PEP 8 limit of 88 characters.
- issue_cycle__issue__state__group__in=["backlog", "unstarted", "started"], + issue_cycle__issue__state__group__in=[ + "backlog", + "unstarted", + "started" + ],🧰 Tools
🪛 Ruff (0.8.2)
140-140: Line too long (97 > 88)
(E501)
Line range hint
586-586
: Fix line length to comply with PEP 8.The line exceeds the PEP 8 limit of 88 characters.
- avatar_url=Case(When(assignees__avatar_asset__isnull=False, then=Concat(Value("/api/assets/v2/static/"), "assignees__avatar_asset", Value("/"),),), + avatar_url=Case( + When( + assignees__avatar_asset__isnull=False, + then=Concat( + Value("/api/assets/v2/static/"), + "assignees__avatar_asset", + Value("/"), + ), + ),🧰 Tools
🪛 Ruff (0.8.2)
140-140: Line too long (97 > 88)
(E501)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apiserver/plane/app/views/cycle/base.py
(3 hunks)packages/types/src/cycle/cycle.d.ts
(2 hunks)web/core/components/cycles/list/cycle-list-item-action.tsx
(2 hunks)web/core/components/cycles/quick-actions.tsx
(1 hunks)web/core/components/cycles/transfer-issues-modal.tsx
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- web/core/components/cycles/quick-actions.tsx
- web/core/components/cycles/list/cycle-list-item-action.tsx
🧰 Additional context used
🪛 Ruff (0.8.2)
apiserver/plane/app/views/cycle/base.py
140-140: Line too long (97 > 88)
(E501)
🪛 GitHub Actions: Build and Lint on Pull Request
apiserver/plane/app/views/cycle/base.py
[error] 586-586: Line too long (146 > 88 characters)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: lint-apiserver
- GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
packages/types/src/cycle/cycle.d.ts (2)
107-107
: LGTM! The newpending_issues
property aligns with backend changes.The addition of
pending_issues
to theICycle
interface correctly reflects the backend changes inCycleViewSet
where pending issues are now counted.
124-124
: LGTM! Type definition formatting is clean.The
SelectCycleType
formatting change improves readability without affecting functionality.web/core/components/cycles/transfer-issues-modal.tsx (1)
60-61
: LGTM! Function name change better reflects its purpose.The replacement of
fetchCycleDetails
withfetchActiveCycleProgress
is more descriptive and aligns with the new pending issues functionality.apiserver/plane/app/views/cycle/base.py (1)
135-146
: LGTM! The pending_issues annotation is well implemented.The annotation correctly counts issues that are in backlog, unstarted, or started states while properly filtering out archived, draft, and deleted issues.
🧰 Tools
🪛 Ruff (0.8.2)
140-140: Line too long (97 > 88)
(E501)
Description
Added cancelled issues count to pending issues.
Type of Change
References
WEB-3102
Summary by CodeRabbit
Release Notes
New Features
pending_issues
property to track unfinished issues in cycles.Improvements
Technical Updates