Skip to content

fix: restore code lost when release 3.12.0 was merged to main - #407

Merged
drtechie merged 1 commit into
mainfrom
fix/main-restore-merge-loss
Nov 6, 2026
Merged

drtechie merged 1 commit into
mainfrom
fix/main-restore-merge-loss

Conversation

@drtechie

@drtechie drtechie commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Problem

main does not compile. When release 3.12.0 was merged to main (#397), conflict resolution kept the callers but dropped the code they call:

  • UserServiceImpl calls UserServiceRoleDTO.setTuId / setTuName / setHealthFacilityId
  • IncentiveServiceImpl calls UserServiceRoleRepo.getUserRolesByIds
  • TBController calls TBConfirmedCaseService.saveReferralFollowUp

None of these exist on main.

Fix

Cherry-pick of 3379e00 ("fix code merge issue", from #403 on release-3.12.1). It restores exactly those pieces, and nothing else from 3.12.1 comes with it.

Checked

  • Compiles: mvn clean compile passes.
  • Tests: 271 run; 32 failures and 12 errors. The same 44 tests fail on release-3.12.1, so this commit adds no new failures.
  • I compared every file 3.12.0 changed against main. Apart from these three, 3.12.0's changes are all on main.
    • NotificationService.java and FlwApplicationTest.java are absent from main, but they were deliberately deleted on the main line earlier, and nothing references them.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added the ability to save and retrieve referral and preventive treatment follow-up records for tuberculosis care.
    • Tuberculosis treatment incentives now depend on completed treatment and follow-up details. Drug-resistant treatment incentives require a cured outcome; other regimens follow standard incentive rules.
    • Added eligibility checks based on treatment duration, with thresholds determined by the regimen.

(cherry picked from commit 3379e00)
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The changes add Stop TB location fields and a user-role query. They also add referral and TPT follow-up save and retrieval flows, with updated incentive eligibility checks.

Changes: Stop TB Role Location Scope

Layer / File(s) Summary
Role location fields and query
src/main/java/com/iemr/flw/dto/iemr/UserServiceRoleDTO.java, src/main/java/com/iemr/flw/repo/iemr/UserServiceRoleRepo.java
UserServiceRoleDTO adds TU and health-facility IDs and names. UserServiceRoleRepo adds a query for role records matching user IDs that are not deleted.

TB Follow-Up and Incentive Flows

Layer / File(s) Summary
Follow-up service contract and wiring
src/main/java/com/iemr/flw/service/TBConfirmedCaseService.java, src/main/java/com/iemr/flw/service/impl/TBConfirmedCaseServiceImpl.java
The service declares referral and TPT follow-up save and retrieval methods. The implementation adds follow-up persistence and incentive dependencies.
Confirmed-case incentive criteria
src/main/java/com/iemr/flw/service/impl/TBConfirmedCaseServiceImpl.java
Confirmed-case incentives now require completed treatment and a follow-up date. The implementation adds a minimum-month date eligibility check.
Referral follow-up save and retrieval
src/main/java/com/iemr/flw/service/impl/TBConfirmedCaseServiceImpl.java
The implementation maps and saves referral follow-up data. Retrieval validates the token, fetches the current user's records, formats dates, and serializes the results.
TPT follow-up and incentive processing
src/main/java/com/iemr/flw/service/impl/TBConfirmedCaseServiceImpl.java
The implementation saves and retrieves TPT follow-up records. It maps follow-up fields and creates a preventive-TB incentive only when treatment, regimen, date, beneficiary, and follow-up-month requirements are met.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Possibly related PRs

  • PSMRI/FLW-API#393: Selects a Nikshay-mapped primary role, which affects the TU and facility data held in UserServiceRoleDTO.

Suggested reviewers: sauravbizbrolly, vishwab1

Merge Risk: Moderate · up to 647c6

The referral follow-up save loses the referred-on date and can store blank records while reporting success. Fix both before merging.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE


TbTptFollowUp tbTptFollowUp = new TbTptFollowUp();

if (token != null && !token.isEmpty() && requestDTO != null) {
@@ -271,4 +734,32 @@ private TBConfirmedCaseDTO toDTO(TBConfirmedCase entity) {

@drtechie
drtechie merged commit 81d1983 into main Nov 6, 2026
2 of 5 checks passed
@drtechie
drtechie deleted the fix/main-restore-merge-loss branch November 6, 2026 08:32
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.

3 participants