Skip to content

Role Mapping Not Saving When Updating Multiple Roles (Registrar/Nurse/Counsellor) - #148

Merged
vanitha1822 merged 2 commits into
release-3.8.4from
vb/rolenoteedit
Sep 11, 2026
Merged

Role Mapping Not Saving When Updating Multiple Roles (Registrar/Nurse/Counsellor)#148
vanitha1822 merged 2 commits into
release-3.8.4from
vb/rolenoteedit

Conversation

@vishwab1

Copy link
Copy Markdown
Member

📋 Description

JIRA ID: AMM-2471

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.

vishwab1 and others added 2 commits September 4, 2026 15:28
…roles

Two related bugs in the user-role-work-location mapping endpoints,
both confirmed via live DB timestamp inspection against a real
StopTB user with multiple roles (Registration Officer/Nurse/Counsellor).

1. UserRoleMappings() (POST userRoleMappings, create): the loop built
   one M_UserServiceRoleMapping2 object across all iterations of the
   per-role loop and only added it to the save list once, after the
   loop closed - so a batched request carrying multiple roles (e.g.
   Nurse + Counsellor together) silently discarded every role but the
   last one. Object creation and resList1.add() now happen once per
   role, inside the loop.

2. softDeleteOldMappings (called from updateUserRoleMapping): scoped
   only by userID + providerServiceMapID, so saving/updating ANY one
   role's mapping soft-deleted every OTHER active role that user held
   under the same service line, even roles never mentioned in that
   request and saved in a completely separate, earlier call. Added
   roleID to the WHERE clause (and threaded it through
   EmployeeMasterInter/EmployeeMasterServiceImpl/the controller call
   site) so it only cleans up true duplicates of the same role.

Verified live: after this fix, a user's Registration Officer + Nurse
+ Counsellor mappings all stay simultaneously active across separate
saves, with Registration Officer + Nurse created together in one
batched call (matching CreatedDate) and Counsellor from an earlier
save left untouched by later, unrelated saves.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

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.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c821dbe2-2acc-4f75-8f5b-c40aa7dc1ad0

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@vanitha1822
vanitha1822 merged commit de57d4f into release-3.8.4 Sep 11, 2026
2 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

2 participants