Details
-
Bug
-
Status: Closed (View Workflow)
-
TBD
-
Resolution: Done
-
ERM Sprint 159
-
Bienenvolk
-
Orchid (R1 2023)
-
Data related (ex. Can be detected with large dataset only)
Description
Overview:
If an agreement or license has >10 internal contacts, then when viewing or editing the agreement or license only 10 of the contacts display information (name/phone/email).
This is because we do not fetch using the correct syntax using a limit parameter etc.
Steps to Reproduce:
- Create an agreement
- Add more than 10 "internal contacts" to the agreement or license
- Save the agreement or license
- View or edit the agreement or license
- View the internal contacts
Expected Results:
All internal contacts display correctly with full details
Actual Results:
A maximum of 10 internal contacts display correctly with full details
Additional Information:
There is a fetch to `/users` with a query listing the user UUIDs, but no "limit" parameter is included so only 10 are returned. We can specify a limit parameter=1000 to get more (as we do for example to populate the internal contact filter.
Note that the query when viewing a single agreement also differs in the query syntax used using only a single `=` in the query:
query=id=<uuid>
rather than
{{query=id==<uuid>
}}used when we fetch for the filter
Dev task breakdown
We should add a limit=1000 to the useUsers hook in stripes-erm-components, as this will affect multiple places in our codebase.
https://github.com/folio-org/stripes-erm-components/blob/master/lib/hooks/useUsers.js#L7
Changing this line to something like:
const query = userIds.map(uid => `id==${uid}`).join(' or ') ?? []; if (query.length) { query += "&limit=1000" }
This code change has not been checked, needs testing against network tabs output and payload chekcing to make sure query is as expected and returned values are as expected.
The code is a little odd at the minute. If no ids are passed then query is an empty array, and behaviour expects this. This could be neatened as part of this work to make sure query is an empty string instead if no ids are present, and if that's done it is important to check that it works both when no ids are passed and when some are, for example while the list of relevant ids loads in the implementing code.
Also make sure the equivalence operator in the query is `==` as this is CQL exact match operator which should be used in this case