Repository navigation
feat(stoptb): bulk user upload fixes, Stop TB team in Work Location Mapping and Min Stock in Item Master - #174
Merged
Merged
Conversation
Selecting all facilities across multiple Nikshay TUs (e.g. a full
district) could push 1000+ facility IDs into a single comma-separated
GET query string, exceeding the ~8KB request-line limit enforced by
proxies/Tomcat and causing a 400 before the request ever reached the
controller (observed as a 400/OK Http failure on
/nikshay/location/villages).
getNikshayVillages now splits facilityIDs into batches of 200,
fetches them in parallel via forkJoin, and merges the responses into
the same { data: [...] } shape callers already expect, so no changes
were needed at either call site in work-location-mapping.component.ts.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fix: batch Nikshay villages request to avoid oversized GET query string
…/Counsellor) (#162) * fix: normalize roleID types before diffing existing vs new roles existingRoleIDs (from group.roles) and newRoleIDs (from roleIDs_duringEdit) were compared with plain Array.includes() with no type coercion. When one source returns roleID as a numeric string and the other as a number, an already-existing role fails the match and gets bucketed into both rolesToAdd and rolesToRemove, firing simultaneous create+delete calls that race each other and can silently drop a role (e.g. Counsellor) on update. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: batch newly-added roles into a single SaveWorkLocationMapping call rolesToAdd previously fired one SaveWorkLocationMapping POST per role in parallel via forkJoin. The backend treats a create as the sole active role for the user+serviceline+block scope, so separate parallel creates raced each other and only the last commit stayed active - dropping roles added alongside others (reproduced with StopTB Counsellor + Nurse, where Nurse's row was born already deleted). Batch all rolesToAdd into one call instead, with every new role in the previleges[0].ID array - the same shape already used when two roles are added together via Create New Mapping, which works correctly. Location fields (incl. StopTB's nikshayTUID/nikshayFacilityID) are per-group, not per-role, so batching does not change what is sent for them. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * test: cover role add/keep/remove diffing in updateGroupedWorkLocation - newly-added roles (e.g. Nurse + Counsellor) must go out in a single SaveWorkLocationMapping call, not one per role - an existing roleID stored as a numeric string must be treated as equal to the same roleID selected as a number, so it is kept in-place rather than spuriously added and removed at once Regression coverage for the StopTB Counsellor/Nurse role-dropping bug fixed in the previous two commits. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: reactivate soft-deleted role on re-add; group Stop TB rows like HWC/FLW Two related changes to updateGroupedWorkLocation()'s edit flow, both scoped to make the Select Role checkboxes behave as the single source of truth: checked = active, unchecked = soft-deleted, and re-checking a previously-removed role reactivates it rather than piling up duplicates. 1. Stop TB rows are now grouped by user+TU (Nikshay block), same as HWC/FLW already are, so multiple roles for one user+location show as one row with multiple role chips instead of a separate row per role. This also removes the risk of an edit on one role's row reaching into an unrelated sibling row's role, since everything for that user+location is already one group. 2. A role in rolesToAdd that has an old soft-deleted row (group.roles keeps deleted entries; only existingRoleIDs filters them out) is now reactivated in place via the same {uSRMappingID, deleted:false} call the existing Activate button already uses, with its location/role fields refreshed to the current edit form — instead of always creating a brand-new duplicate row. Only roles with no prior row at all go through the batched create path added in the previous fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * chore: bump version to 3.8.4 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…ccess (#163) OutputResponse returns HTTP 200 with statusCode 5000 on failure, and the global interceptor only special-cases 5002 (session expiry), so an API-level failure reached the success callback. Clicking Activate on a user the backend could not update showed "Activated successfully", then refreshed the list with the user still deactivated -- the failure was only ever visible in the browser console. The success callback now checks statusCode before alerting, and the error callback raises the message instead of just logging it. Co-authored-by: Sneha <sneha@ADMINs-MacBook-Pro.local> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ge districts Stop TB's TU/Facility/Village multi-selects can hold thousands of options, which froze or crashed the tab on low-end PCs: - mat-select re-sorts its selection on every click, Select All and Edit prefill using options.indexOf() inside the sort. Record each item's position when the list is assigned and pass a sortComparator that uses it (5,327 facilities: 81 ms -> 2 ms per sort on a dev PC). - Load facilities/villages after a 400 ms pause and keep only the latest request (switchMap), instead of one request per click where a slow earlier response could overwrite a newer one. - The "all selected" getters run on every change detection; skip building the ID Set unless the selected count can match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… loads The debounced facility/village loads emitted an empty list on reset or deselect, which was applied 400 ms later and could wipe lists that Edit prefill had just filled; a request already in flight could also land after a reset. Emit null instead: it cancels any pending request at once (no debounce) and never assigns anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Edit Edit prefill matched saved TU/facility/village IDs with includes() inside filter(), which is quadratic. Bengaluru City has 6,167 facilities, so a mapping saved with Select All did ~38M comparisons on Edit. Match against a Set instead; same strict equality, same result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the bound value is replaced (Select All, Deselect All, Edit prefill) or the option list changes (reload, search filter), mat-select re-selects every value one by one: a linear search per value, then a full re-sort after each option. On Bengaluru City (6,167 facilities) that froze the page ~0.9 s on a dev PC and ~5.5 s at 6x CPU slowdown. Add an attribute directive on the six Nikshay selects that matches values to options through a Map and sorts once. Same selection, same order; single clicks still go through mat-select. Falls back to mat-select's own code if its internals change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge rows UAT districts reach 1 lakh+ villages (each village repeated under every facility). mat-select draws every option, so 2 lakh villages hung the tab for 10+ minutes even on a fast PC. - Facility and Village options sit in a cdk-virtual-scroll-viewport inside the same mat-select panel: same field, label, search box, Select All link and checkbox rows; only the rows on screen exist. - appFastBulkSelect keeps the full bound value when options are virtual (a click adds/removes just that option, the field is not shown empty when the selected rows are scrolled away) and measures the list when the panel opens. A mat-select-trigger shows the selected names. - Search filter and "all selected" checks are cached until the list, selection or search text changes. 6x CPU slowdown: 5 lakh villages open 0.00 s, Select All 1.1 s, click 0.3 s; Bengaluru facilities open 1.4 s -> 0.09 s. Create/Edit/Save/Reset results identical to release-3.8.4 on Bengaluru and Mayurbhanj. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The virtual scroll list needs every row the same height, but long facility names wrapped onto 3 lines and the list scrolled sideways. Keep each row at 48 px on one line with "...", show the full name on hover, and hide the horizontal scroll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in Change Username, Update Village (needs Admin-API 3.9.1 villageMapping/updateVillage), removal of 4 unused services and the bootstrap/tslib/lint-staged bumps. No Work Location Mapping files change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In AMRIT a team is a van. Stop TB gets an optional "Select Team" field on Create and Edit, listing the MMU vans of the selected state, with the team's current members shown under it. A team has many users and a user is in one team, so picking another team moves the user. - Create: the chosen team is kept on the added row and assigned after the mapping saves (once per user). - Edit: pre-selects the user's team; Update reassigns only when the team changed, and "No team" takes the user out of it. - A team that cannot be assigned is reported; the mapping stays saved. Needs Admin-API /stoptb/team/* (same branch name in Admin-API). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The van ID is what each camp laptop is configured with (STOPTB_VAN_ID), so admins can match a team to its laptop without relying on names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te (AMM-2496) The team is now stored as VanID on the mapping rows (Admin-API), so the chosen team goes in the same Save/Update request as the mapping instead of a separate assign call. Every role row of the user carries the same team; "No team" sends null. Save and Update now check statusCode in the response: the API returns failures such as a team from another state as HTTP 200 with a 5000 status, which used to show "saved successfully". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release-3.11.0 merge brought a new bulkuser_excel_sheet.xlsx; this branch keeps the 3.8.4 template. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r list - Template: EmployeeId column after UserName/Password (column N); the dropdowns after it moved with their columns. Admin-API 3.12.0 makes Employee Id mandatory and unique. - A chosen file is only checked (EmployeeId column present, not empty) and shows "N user(s) ready"; the upload starts on the new Submit button. - The user list reloads after users are created and when going back. Back only asks to confirm when a checked file is still waiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Admin sets the stock threshold per item; Inventory's Low Stock report lists items at or below it. Empty keeps the current value; 0 clears it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…B team) into vb/3.11.0-item-min-stock Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
|
vanitha1822
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



📋 Description
JIRA ID:
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
✅ Type of Change
ℹ️ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.