I noticed issues when I was executing the test case:
Both requisitions are returned on Postman even when only one of them should be returned (steps 4, 5) or when none should be returned (step 7).
1. GET /api/requisitions/requisitionsForConvert?filterValue=Essential Meds&filterBy=programName
2. Requisitons for Family Planning are in response
If the facilityName filter is not provided, then all facilities are fetched and database search ignore programName filter (RequisitionRepositoryImpl line 403). OR should probably be changed to AND. or RequisitonService line 787 should change.
GET /api/requisitions/requisitionsForConvert should allow you to filter both ways:
Filtering by "programName" should work correctly and only show requisitions from that program. (Currently this does not work.)
Filtering by "facilityName" or "facilityCode" should work correctly and only show requisitions from that facility. (Currently this does not work.)
Filtering by "all" should apply both filters at once, only returning requisitions for the given program and or the given facility. (Currently this works, but make sure it will works still.) If you provide value that does not match any facility nor program, it should return nothing. (Currently this does not work.)
Update the Zephyr Test if this fix changes that: https://openlmis.atlassian.net/browse/OLMIS-3050
Post a comparison of the before and after API response times (we want to make sure that fixing this bug does not make the end-points really slow. We do not want to un-do the optimizations that were done in to improve speed.)
Test in UI whether searching in Convert Requisitions to Order is working now (see for a screenshot). If there are separate UI issues, please file a UI bug for that. (Fifth comment below suggests there may be separate UI issues.)
When I try to search as divo1 by "Macaue-2, Cuamba" on UI, I have in response requisitions that have different facility than Macaue-2, Cuamba
If you search using "Macaue-2, Cuamba" on UI, this is actually filtering by 2 separate values - "Macaue-2" and "Cuamba" (see the request sent to the server). This is not perfect, but that's how it was designed.
are treated as separate entries.
Given the above and fix for the duplicate keys, everything now is ok.