Incorrect filtering by multiple values in requisitionsForConvert endpoint

Description

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

Repro steps:
1. GET /api/requisitions/requisitionsForConvert?filterValue=Essential Meds&filterBy=programName
2. Requisitons for Family Planning are in response

Root cause:
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.

Acceptance Criteria

  • 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.)

Environment

None

Status

Assignee

Sebastian Brudziński

Reporter

Joanna Bebak

Story Points

2

Time tracking

24h

Epic Link

Components

Sprint

None

Priority

Critical