Fix(*) update induction status no show #428
Conversation
WalkthroughThe changes in this pull request involve updates to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
wp-content/civi-extensions/goonjcustom/Civi/InductionService.php (2)
Line range hint
528-572: Duplicate batch processing logic detected; consider refactoringThe methods
updateInductionStatusNoShow(lines 528-572) andsendFollowUpEmailscontain similar batch processing logic for retrieving and processing activities. This duplication violates the DRY (Don't Repeat Yourself) principle and can make maintenance more difficult. Refactor the common logic into a private helper method to improve code maintainability and adhere to best practices.
537-540: Reliance on email subject for activity identification is fragileUsing the email
subjectfield to identify follow-up email activities (lines 537-540) is brittle and may fail if the subject line changes. To make the code more robust, consider using a unique identifier, such as a custom activity type or a dedicated metadata field, to reliably fetch these activities.
| $unscheduledInductionContactIds = Activity::get(FALSE) | ||
| ->addSelect('source_contact_id') | ||
| ->addWhere('activity_type_id:name', '=', 'Induction') | ||
| ->addWhere('status_id:name', '=', 'To be scheduled') | ||
| ->execute()->column('source_contact_id'); |
There was a problem hiding this comment.
Potential performance issue when fetching unscheduled induction contact IDs
Fetching all unscheduled induction contact IDs at once (lines 528-532) can lead to performance issues if the dataset is large. This approach may consume excessive memory and impact system responsiveness. Consider processing these contacts in batches or using a streamed query to enhance scalability.
To be scheduledReminder for Induction slot bookingEmail Activity for these contactSummary by CodeRabbit
New Features
Bug Fixes
Documentation