Skip to content

Bug/fix hbyc incentive logic#89

Merged
SauravBizbRolly merged 4 commits intoPSMRI:release-3.10.0from
toarunmishra:bug/fix_hbyc_incentive_logic
Nov 27, 2025
Merged

Bug/fix hbyc incentive logic#89
SauravBizbRolly merged 4 commits intoPSMRI:release-3.10.0from
toarunmishra:bug/fix_hbyc_incentive_logic

Conversation

@SauravBizbRolly
Copy link
Collaborator

@SauravBizbRolly SauravBizbRolly commented Nov 27, 2025

📋 Description

JIRA ID:

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ 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

    • Adjusted weight threshold for SNCU follow-up eligibility to include babies at exactly 2.5 kg.
  • New Features

    • Extended incentive eligibility windows to include 12-month milestone for HB Sync visit tracking.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 27, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Updated 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

Cohort / File(s) Change Summary
HBYNC Incentive Logic Updates
src/main/java/com/iemr/flw/service/impl/ChildCareServiceImpl.java
Extended 1st and 2nd incentive trigger windows in checkAndAddHbyncIncentives to include "12 Months" alongside "3 Months", "6 Months", "9 Months", and "15 Months" for hbyncVisitActivity and hbync15MonethVisitActivityCH. Added blank line separation before hbyncOrsPacketActivityCH branch. Updated weight threshold in getHBNCDetails from < 2.5 to <= 2.5 for SNCU follow-up eligibility. Removed extraneous blank line in createIncentiveRecordforSamReferalToNrc.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Weight threshold operator change (< to <=) requires verification that the business logic intent aligns with boundary inclusion
  • Incentive trigger window expansion follows a repetitive pattern across multiple conditions, reducing review complexity
  • Limited file scope with localized, non-cascading changes

Poem

🐰 A rabbit hops through incentive tracks,
With "12 Months" now joining the tax,
Weight thresholds shift with equal grace,
And whitespace finds its proper place! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Bug/fix hbyc incentive logic' accurately reflects the main changes, which involve fixing HBYC (HBNC) incentive logic by extending trigger windows and updating weight thresholds.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@SauravBizbRolly
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Nov 27, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a 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)
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 condition

Including "12 Months" alongside 3/6/9/15 for both hbyncVisitActivity and hbync15MonethVisitActivityCH aligns with the stated objective so incentives will also fire at the 12‑month visit. The long repeated visit_day chain 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 weight

Changing the SNCU follow‑up condition to hbncVisit.getBaby_weight() <= 2.5 means 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

📥 Commits

Reviewing files that changed from the base of the PR and between 125912d and 3f73a2b.

📒 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 fine

The added blank line before the hbyncOrsPacketActivityCH block just improves visual separation between quarterly‑visit and ORS‑distribution incentives; no behavioural change and it’s harmless to keep.

@SauravBizbRolly SauravBizbRolly merged commit cb4c846 into PSMRI:release-3.10.0 Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant