Skip to content

Block not visible in work location mapping - #157

Merged
snehar-nd merged 6 commits into
release-3.8.2from
vb/release-block
Aug 10, 2026
Merged

Block not visible in work location mapping#157
snehar-nd merged 6 commits into
release-3.8.2from
vb/release-block

Conversation

@vishwab1

Copy link
Copy Markdown
Member

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

vishwab1 and others added 6 commits August 3, 2026 00:14
- Stop TB Create was hardcoding villageID/villageName to null, silently
  dropping the admin's village selection; it now saves them the same
  way Edit already does.
- Old-style (pre-Nikshay) Stop TB users no longer get a guessed
  district auto-selected on Edit via AMRIT name-matching, and no
  longer inherit a stale AMRIT district ID into the Nikshay district
  field. District/TU/Facility/Village now come up blank for these
  rows so the admin picks fresh Nikshay values.
- Edit's Stop TB Block/TU/Facility/Village dropdowns now have the same
  search box and Select All control Create already has.
- MMU/TM's Edit Village dropdown was also missing search (had Select
  All only) - added for consistency.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Long comma-joined village lists (especially Stop TB's, sourced from an
entire TU/facility) were either blowing out row height or, via the
table-responsive wrapper, forcing the whole table to scroll
horizontally past Edit/Deactivate. The Village cell now gets its own
fixed-width, scrollable/draggable box with a hover tooltip showing the
full list, so the rest of the columns stay on screen.

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

Stop TB's Select Block is a single-select quick-add convenience over the
same TU list Select TU manages (see onNikshayBlockChange) — it isn't a
separate saved value. loadNikshayTUsForEditContinued() restored
selectedNikshayTUs (so Select TU showed correctly) but never wrote back
to selectedNikshayBlock, so it rendered empty on Edit even though the
TU/block was fully saved. Pre-fill it whenever exactly one TU is
restored, the case for all live Stop TB rows.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The previous fix guessed selectedNikshayBlock off selectedNikshayTUs.length
== 1, which left Block blank whenever a row had more than one TU (a real,
observed case). blockID/blockName on m_userservicerolemapping ARE the
saved Select Block value in their own right, stamped by
onNikshayBlockChange() at save time independent of how many TUs later
joined NikshayTUID. Use getNikshayUserMappingData's blockID directly to
look up the matching entry in nikshayTUList instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Create's setWorkLocationObject and Edit's updateGroupedWorkLocation both
wrote blockID/blockName from selectedNikshayTUs[0] — whichever TU
happened to land first in the multi-select array — instead of the TU the
admin actually picked in Select Block. That's order-dependent, not
selection-dependent: adding a second TU after picking Block, or in a
different order, silently changes what gets saved as the block with no
relation to what Select Block showed on screen.

Both paths now read selectedNikshayBlock.nikshayTUID/tUName directly,
falling back to the first selected TU only when Block was never touched.
Combined with the earlier edit-load fix (looking the saved blockID up in
nikshayTUList), Select Block now round-trips correctly: whatever's picked
is what's saved, and it's what shows back up next time the row is edited.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
getNikshayUserMappingData() (/admin-api/nikshay/location/userMapping)
only returns nikshayTUID/nikshayFacilityID/districtID — verified against
a live UAT response — it never carries blockID/blockName. The previous
fix read data.blockID from exactly that response, so it was always
undefined -> NaN -> the lookup silently no-op'd and Select Block stayed
blank on every edit, regardless of what was actually saved.

edit_Details already holds blockID/blockName intact — it's sourced from
getUserRoleMapped (v_userservicerolemapping) when the row is opened for
Edit, which does carry both columns. Pull savedBlockID from there
instead. No backend change needed.

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

coderabbitai Bot commented Aug 10, 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 Plus

Run ID: f7827a52-defa-4ba4-8bcc-23a70a311de4

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.

@sonarqubecloud

Copy link
Copy Markdown

@snehar-nd
snehar-nd merged commit 257d096 into release-3.8.2 Aug 10, 2026
4 checks passed
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