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

Activity

Show:
Paweł Albecki
March 22, 2018, 4:17 PM

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

Sebastian Brudziński
March 22, 2018, 4:22 PM

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.

Sebastian Brudziński
March 22, 2018, 4:36 PM

Both

and

are treated as separate entries.

Paweł Albecki
March 23, 2018, 8:59 AM

Given the above and fix for the duplicate keys, everything now is ok.

Assignee

Sebastian Brudziński

Reporter

Joanna Bebak

Story Points

2

Time tracking

0m

Time remaining

0m

Epic Link

Components

Sprint

None

Priority

Critical
Configure