prime-simplereport icon indicating copy to clipboard operation
prime-simplereport copied to clipboard

[BUG] Fix download csv test results filters

Open emyl3 opened this issue 1 year ago • 1 comments

Description

As a user, when I select filters (e.g. "Condition") on the "Test Results" page and I click the "Download results" button, the confirmation modal displays the correct number of rows in the CSV download. However, when opening the CSV result, the result is unfiltered.

Steps to reproduce

If applicable, add screenshots to help explain your problem.

  1. Go to the "Test results" page
  2. Select a "Condition" and/or "Test Result" filter
  3. Click the "Download results" button
  4. In the "Download test results" confirmation modal, see that the number of rows to be included is correct and click "Download results"
  5. Open the downloaded CSV
  6. See that the CSV does not match the filtered results

Expected behavior

As a user, I would expect the CSV download rows matches the results when the filters are applied

Additional context

Please ensure every filter is working for the download

emyl3 avatar Jul 24 '24 20:07 emyl3

Looks like when we added condition and test result filtering to the result page, we forgot to add it to the Download results functionality as well - we pass the correct filter values to the query but it doesn't use them: https://github.com/CDCgov/prime-simplereport/blob/1336ab09ddd8d2638db054c3c0da21ad16472fe2/frontend/src/app/testResults/operations.graphql#L18-L27

mehansen avatar Jul 24 '24 20:07 mehansen

Reopening because I am still seeing this bug in demo with the test result filter. I think because the backend query is returning test events, we're going to get any test event that has at least 1 result matching the filter, so the current logic breaks down for multiplex results. So as an example, if we have the filter applied for positive results, the CSV download will still include all the results for a multiplex test that has at least 1 positive result.

Fwiw I think we really should be querying for test results from the backend instead of test events. That way we don't have to build a query with a bunch of filters on the backend and then filter again on the frontend like we are now.

mehansen avatar Aug 27 '24 16:08 mehansen