-
Notifications
You must be signed in to change notification settings - Fork 563
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
[Fix] Sprint ID when find Module tasks #8719
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request modifies the Changes
Suggested reviewers
Possibly related PRs
Poem
Finishing Touches
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)
packages/core/src/lib/tasks/task.service.ts (1)
Line range hint
776-869
: Consider refactoring for improved maintainability.The
findModuleTasks
method is handling multiple concerns and could benefit from some refactoring:
- Extract the query building logic into separate methods
- Enhance error logging with structured information
- Consider using a query builder pattern for better maintainability
Example refactor for the query building:
private buildModuleTasksBaseQuery(): SelectQueryBuilder<Task> { const query = this.typeOrmRepository.createQueryBuilder(this.tableName); query.leftJoin(`${query.alias}.modules`, 'modules'); return query; } private applyModuleTasksFilters( query: SelectQueryBuilder<Task>, filters: { status?: string; title?: string; prefix?: string; isDraft?: boolean; isScreeningTask?: boolean; organizationSprintId?: string; } ): void { const { status, title, prefix, isDraft, isScreeningTask, organizationSprintId } = filters; const likeOperator = isPostgres() ? 'ILIKE' : 'LIKE'; query.andWhere(new Brackets((qb: WhereExpressionBuilder) => { if (isNotEmpty(status)) { qb.andWhere(p(`"${query.alias}"."status" = :status`), { status }); } // ... other filters if (isUUID(organizationSprintId)) { qb.andWhere(p(`"${query.alias}"."organizationSprintId" = :organizationSprintId`), { organizationSprintId }); } else { qb.andWhere(p(`"${query.alias}"."organizationSprintId" IS NULL`)); } })); }And enhance error logging:
} catch (error) { console.error('Error while retrieving module tasks', { error: error.message, stack: error.stack, context: { organizationId, projectId, modules, status } }); throw new BadRequestException(error); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/core/src/lib/tasks/task.service.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: build
- GitHub Check: test
🔇 Additional comments (1)
packages/core/src/lib/tasks/task.service.ts (1)
839-843
: LGTM! The sprint ID handling logic has been improved.The updated implementation correctly handles the
organizationSprintId
filter by:
- First checking if it's a valid UUID to filter by the specific sprint
- Falling back to NULL if it's not a valid UUID
This fix ensures proper filtering of tasks based on sprint assignments.
View your CI Pipeline Execution ↗ for commit 91805e1.
☁️ Nx Cloud last updated this comment at |
PR
Please note: we will close your PR without comment if you do not check the boxes above and provide ALL requested information.
Summary by CodeRabbit