-
Notifications
You must be signed in to change notification settings - Fork 3
Operation tasks #371
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
base: main
Are you sure you want to change the base?
Operation tasks #371
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR refactors the cycle query resolvers to normalize date comparisons using startOfDay and refines completion and status filters for more accurate and streamlined cycle retrieval. Sequence diagram for getCyclesActive query with normalized date comparisonssequenceDiagram
participant Client
participant CycleResolver
participant TaskModel
participant CycleModel
Client->>CycleResolver: getCyclesActive(params)
alt params.taskId is provided
CycleResolver->>TaskModel: findOne({_id: params.taskId})
TaskModel-->>CycleResolver: Task
end
CycleResolver->>CycleModel: find({
teamId: params.teamId,
isCompleted: false,
$or: [
{isActive: true},
{_id: params.cycleId},
{startDate <= today, endDate >= today},
{startDate > today}
]
})
CycleModel-->>CycleResolver: Cycles
CycleResolver-->>Client: Cycles
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
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.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `backend/plugins/operation_api/src/modules/cycle/graphql/resolvers/queries/cycle.ts:62` </location>
<code_context>
query: {
teamId: params.teamId,
- isCompleted: { $ne: true },
+ isCompleted: false,
$or: [
- { isActive: true },
</code_context>
<issue_to_address>
**issue (bug_risk):** Changing isCompleted filter from '$ne: true' to 'false' may alter results.
This change excludes cycles with undefined or null isCompleted values, which may impact results if legacy data lacks this field.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
WalkthroughUpdated cycle query resolvers to adjust filters: removed isCompleted constraint from getCycles; revised getCyclesActive to use startOfDay for “today,” added endDate >= today, tightened startDate <= today, added future-start branch, and set isCompleted to false explicitly. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant Resolver as CycleResolver
participant DateFns as date-fns
participant DB as Database
rect rgba(200,235,255,0.3)
note over Client,Resolver: getCycles(teamId)
Client->>Resolver: Query getCycles
Resolver->>DB: find({ teamId })
DB-->>Resolver: cycles
Resolver-->>Client: cycles
end
rect rgba(220,255,220,0.35)
note over Client,Resolver: getCyclesActive(teamId)
Client->>Resolver: Query getCyclesActive
Resolver->>DateFns: startOfDay(new Date())
DateFns-->>Resolver: today
Note right of Resolver: Build filter:<br/>isCompleted: false<br/>teamId: X<br/>date window:<br/>- startDate <= today AND endDate >= today<br/>OR startDate > today
Resolver->>DB: find({ teamId, isCompleted: false, date conditions })
DB-->>Resolver: active cycles
Resolver-->>Client: active cycles
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursorrules)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursorrules)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Important
Looks good to me! 👍
Reviewed everything up to ed3c682 in 1 minute and 13 seconds. Click for details.
- Reviewed
49lines of code in1files - Skipped
0files when reviewing. - Skipped posting
4draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. backend/plugins/operation_api/src/modules/cycle/graphql/resolvers/queries/cycle.ts:26
- Draft comment:
Removed 'isCompleted: false' filter in getCycles query. Confirm if returning all cycles (including completed) is intended. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. backend/plugins/operation_api/src/modules/cycle/graphql/resolvers/queries/cycle.ts:33
- Draft comment:
Good use of startOfDay for consistent date comparisons in getCyclesActive. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
3. backend/plugins/operation_api/src/modules/cycle/graphql/resolvers/queries/cycle.ts:60
- Draft comment:
Changed 'isCompleted' condition from { $ne: true } to false. Ensure all cycles have an explicit boolean value for isCompleted. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
4. backend/plugins/operation_api/src/modules/cycle/graphql/resolvers/queries/cycle.ts:65
- Draft comment:
Removed cycleId and isActive filtering in the $or clause. Confirm this change aligns with the desired behavior when a taskId is provided. - Reason this comment was not posted:
Comment looked like it was already resolved.
Workflow ID: wflow_dR7jfMzP8wwSvBA7
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Summary by Sourcery
Enhance cycle GraphQL queries to use date-based filtering and adjust completion criteria
Enhancements:
Summary by CodeRabbit
New Features
Bug Fixes