Skip to content

fix: resolve ONLY_FULL_GROUP_BY violations and bulk registration username bug#136

Open
vishwab1 wants to merge 88 commits into
release-3.8.2from
vb/fixservice
Open

fix: resolve ONLY_FULL_GROUP_BY violations and bulk registration username bug#136
vishwab1 wants to merge 88 commits into
release-3.8.2from
vb/fixservice

Conversation

@vishwab1

Copy link
Copy Markdown
Member

📋 Description

JIRA ID: AMM-2335

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

Summary

  • Fix bulk employee registration setting username from contact number instead of the actual username field (BulkRegistrationServiceImpl.java)
  • Remove unnecessary GROUP BY clauses causing ONLY_FULL_GROUP_BY SQL mode violations in two service-lookup queries, replacing one with DISTINCT to preserve dedup behavior without grouping by a non-selected column

✅ 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.

5Amogh and others added 21 commits November 18, 2025 11:08
fix: amm-1927 send headers only if the request is from the allowed origin
# Conflicts:
#	src/main/java/com/iemr/admin/service/employeemaster/EmployeeSignatureServiceImpl.java
…#121)

* fix:changed the pom xml

* fix: added facilty type master change

* feat: created facility creation

* fix: rabiit review fix

* fix: rabiit review fix

* fix: rabiit review fix

* fix: pom version
* fix:changed the pom xml

* fix: added facilty type master change

* feat: created facility creation

* feat:added work location

* feat:added work location

* fix: rabiit review fix

* fix: rabiit review fix

* fix: rabiit review fix

* fix: ui chnges

* fix: pom version

* fix: corrections

* fix: facilty hierachy

* fix: facility heirachy

* fix: remove logs folder from repository

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: add logs/ to .gitignore

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix:changed the pom xml

* fix: added facilty type master change

* feat: created facility creation

* feat:added work location

* feat:added work location

* fix: rabiit review fix

* fix: rabiit review fix

* fix: rabiit review fix

* fix: ui chnges

* fix: pom version

* fix: corrections

* fix: facilty hierachy

* fix: facility heirachy

* fix: item facility mapping and store updates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: fixed inventory flow

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Cherry-pick health and version API enhancements to release-3.6.1 (#124)

* feat(health,version): add health and version endponts

* fix(health): add constant and remove duplicates

* fix(health): avoid permanent DEGRADED from historical deadlocks

* fix(health): Removed the unnecessary boolean literal

* fix(health):  Fixed the broken lock-wait detection

* fix(health): avoid blocking DB I/O under write lock and restore interrupt flag

* fix(health): add cancelFutures in healthservice

* fix(health): close basic DB connection before advanced checks and remove shared-map race

* feat: expose account lock state in SearchEmployee4 (#129)

Co-authored-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>

* Fix the reset password issue (#131)

* fix: reset password

* fix: build issue

* fix: update the url

* fix: update config properties

* fix: initialize constructor

---------

Co-authored-by: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com>
Co-authored-by: Varun Deep Saini <deep.sa@rippling.com>
Co-authored-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>
Co-authored-by: Vanitha S <116701245+vanitha1822@users.noreply.github.com>
GROUP BY sm.serviceName selected non-aggregated, non-functionally-dependent
columns (serviceID, isNational, statusID), which MySQL rejects under
ONLY_FULL_GROUP_BY. Use SELECT DISTINCT instead since no aggregation is
actually needed.
…tead of username field

mUser.setUserName(employee.getContactNo()) was using the uploaded
contact number as the login username, ignoring the actual UserName
column in the bulk upload sheet.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Conflicts:
#	src/main/java/com/iemr/admin/service/bulkRegistration/BulkRegistrationServiceImpl.java
#	src/main/java/com/iemr/admin/utils/JwtUserIdValidationFilter.java
@coderabbitai

coderabbitai Bot commented Jun 29, 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: Pro

Run ID: 4f4b084d-5049-4bc9-afd5-d8ae809f4738

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.

vishwab1 and others added 6 commits July 10, 2026 13:42
…plicate-mapping fix

- New isolated tables/entities: NikshayTU, NikshayFacility,
  NikshayVillageFacilityMapping, with read-only cascading lookup endpoints
  (NikshayLocationController) — no existing master tables touched.
- M_UserServiceRoleMapping2 gains NikshayTUID/NikshayFacilityID (nullable,
  additive), persisted on both create and update save paths.
- Complete the pre-existing softDeleteOldMappings fix by adding the missing
  service interface/impl methods the controller already called.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…y hierarchy

Nikshay's TU/Facility/Village hierarchy was previously matched against
AMRIT's existing state/district/block/village masters by name. That
approach left ~44% of villages unmatched in practice — partly from
incomplete migration runs, partly from real staleness in AMRIT's own
district/block data (e.g. Andhra Pradesh's 2022 district reorganization
never propagated to m_districtblock/m_DistrictBranchMapping).

Replace it with a fully self-contained Nikshay hierarchy (NikshayState,
NikshayDistrict, NikshayTU, NikshayFacility, NikshayVillage) sourced
directly from Nikshay's own imported data, with no AMRIT matching
involved. Verified: 100% village coverage (325,426/325,426) vs the
previous approach's ~56%.

NikshayLocationController's endpoints keep the same paths and query
params, now backed by the new tables.
Admin-UI now saves one row per user-role with a comma-joined list of
TU/Facility IDs instead of one row per TU x Facility combination, so
the DB columns became TEXT. Update the entity and the request-body DTO
(Previleges1097_3) to match — both were still Integer, which would have
failed to deserialize a value like "12,45,78".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…or Edit

v_userservicerolemapping (and its entity, what the Admin-UI's mapped-list
screen reads) never exposes DistrictID/NikshayTUID/NikshayFacilityID, only
legacy AMRIT WorkingDistrictID/WorkingDistrictName - always null for Stop
TB, which never populates WorkingLocationID. Edit had no way to read back
what was saved, so the TU/Facility/Village pickers always loaded empty.

Reads m_userservicerolemapping directly by USRMappingID (reusing the
existing EmployeeMasterRepo.findByUSRMappingID), same pattern as the
FLW-API worklist-scope query - additive only, the shared view and every
other service line reading it stay untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
InvalidDataAccessApiUsageException: "Executing an update/delete query"
- a @Modifying UPDATE query with no surrounding transaction. Pre-existing
bug in shared code (updateUserRoleMapping, used by every service line),
dormant until now: Stop TB's Edit form was always invalid before today's
fixes (Update button permanently disabled), so nothing ever reached this
code path through Stop TB specifically. Same pattern the other
@Modifying query in this file already follows correctly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
getMappedRole()'s null-district patch (getDirectStateDistrictByMappingIDs)
joins the raw DistrictID column against AMRIT's m_district - correct for
HWC/FLW, where that column genuinely holds an AMRIT district ID. Stop TB's
DistrictID holds a Nikshay district ID instead, so the same join resolves
to whatever AMRIT district happens to share that numeric ID by
coincidence (e.g. Nikshay's Angul, ID 292, resolving to AMRIT's Uttar
Kannad, also ID 292) - showing a completely wrong, unrelated district
name in the mapped-users list.

Skip the District patch for Stop TB rows specifically; State/Block
patching is untouched since those values are genuinely AMRIT-sourced
even for Stop TB.

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

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
13.9% 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.

8 participants