Bug/fix hbyc incentive logic#89
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughUpdated HBYNC incentive trigger conditions in ChildCareServiceImpl to include "12 Months" windows alongside existing month thresholds. Modified weight threshold comparison from less-than to less-than-or-equal for SNCU follow-up eligibility. Removed incidental formatting whitespace. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/java/com/iemr/flw/service/impl/ChildCareServiceImpl.java (2)
764-778: HBYC incentive now correctly includes 12‑month visit; consider de‑duplicating the conditionIncluding
"12 Months"alongside 3/6/9/15 for bothhbyncVisitActivityandhbync15MonethVisitActivityCHaligns with the stated objective so incentives will also fire at the 12‑month visit. The long repeatedvisit_daychain is a bit hard to read and maintain, though.You could centralize the allowed visit days to avoid duplication:
Set<String> eligibleHbycVisits = Set.of("3 Months", "6 Months", "9 Months", "12 Months", "15 Months"); if (hbyncVisitActivity != null && eligibleHbycVisits.contains(hbyc.getVisit_day())) { createIncentiveRecordforHbyncVisit(hbyc, hbyc.getBeneficiaryId(), hbyncVisitActivity, hbyc.getCreated_by()); } if (hbync15MonethVisitActivityCH != null && eligibleHbycVisits.contains(hbyc.getVisit_day())) { createIncentiveRecordforHbyncVisit(hbyc, hbyc.getBeneficiaryId(), hbync15MonethVisitActivityCH, hbyc.getCreated_by()); }
814-820: Inclusive LBW threshold looks intentional; consider null‑safety on weightChanging the SNCU follow‑up condition to
hbncVisit.getBaby_weight() <= 2.5means babies exactly at 2.5 kg will now qualify, which matches an “≤ 2.5 kg” LBW definition and seems consistent with the PR intent.If
getBaby_weight()can ever be null (e.g., optional in the form/DB), this comparison will still throw due to autounboxing. If that’s a realistic scenario, consider a null‑safe guard, for example:Double weight = hbncVisit.getBaby_weight(); if ("42nd Day".equals(hbncVisit.getVisit_day()) && Boolean.TRUE.equals(hbncVisit.getDischarged_from_sncu()) && weight != null && weight <= 2.5) { // existing logic... }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/iemr/flw/service/impl/ChildCareServiceImpl.java(3 hunks)
🔇 Additional comments (1)
src/main/java/com/iemr/flw/service/impl/ChildCareServiceImpl.java (1)
780-784: Blank line before ORS incentive block is fineThe added blank line before the
hbyncOrsPacketActivityCHblock just improves visual separation between quarterly‑visit and ORS‑distribution incentives; no behavioural change and it’s harmless to keep.
📋 Description
JIRA ID:
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
✅ Type of Change
ℹ️ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.
Summary by CodeRabbit
Bug Fixes
New Features
✏️ Tip: You can customize this high-level summary in your review settings.