Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the bulk coop report date and distributor filters. #5938

Merged

Conversation

cillian
Copy link
Contributor

@cillian cillian commented Aug 21, 2020

What? Why?

Closes #5837

Before the date and distributor filters would have no effect. This is because the BulkCoopReport is still generated using an older style method, and isn't generated using the newer method like in the EnterpriseFeeSummaryReport. This older style report expects to receive a q parameter but it actually received the newer style report parameter so the filters were not being applied.

This keeps the newer style report params but converts them, after they are authorised as safe, into the older style in the controller.

There is a test already for checking that the parameters are authorised correctly here.

What should we test?

  1. Go to /order_management/reports/bulk_coop/new
  2. Generate report with no filters, then filter it by date and distributor to see the difference.

Release notes

Fix the bulk coop report date and distributor filters.

Changelog Category: Fixed

Before the date and distributor filters would have no effect. This is because the BulkCoopReport is still generated using an older style method, and isn't generated using the newer method like in the EnterpriseFeeSummaryReport. This older style report expects to receive a :q parameter but it actually received the newer style :report parameter so the filters were not being applied.

This keeps the newer style report params but converts them, after they are authorised as safe, into the older style in the controller.
Copy link
Contributor

@luisramos0 luisramos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, one more PR!

There are quite a few things to standardize and clean up in reports code, I think this fix is fine!

Copy link
Contributor

@sauloperez sauloperez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@filipefurtad0 filipefurtad0 self-assigned this Aug 26, 2020
@filipefurtad0 filipefurtad0 added pr-staged-uk staging.openfoodnetwork.org.uk pr-staged-fr staging.coopcircuits.fr and removed pr-staged-uk staging.openfoodnetwork.org.uk labels Aug 26, 2020
@filipefurtad0
Copy link
Contributor

Hi @cillian ,

I had a look at the Bulk Coop report, before and after the PR. As described in the issue, the date and distributor filters were not working, for the different report types:

image

This is now working, after this PR:

image

However, in the pics above, it can be seen that there are change introduced on the columns. I checked for each report types,a found that before this PR, the columns were:

image

image

image

image

After this PR the columns which appear on all report types are:

image

So, the filters now work fine, but something seems to be breaking the way the reports are generated. I think this may hide relevant information to the users, so maybe better not to send into production. Could you have a second look at this PR? Thank you!

Moving back do InDev.

@filipefurtad0 filipefurtad0 removed the pr-staged-fr staging.coopcircuits.fr label Aug 26, 2020
…rent report types are generated

Also add tests for each of the different report types. I didn't make these JavaScript tests because not sure that is necessary and they would be slower.
…ts but don't check the order.

The #table_items methos seems to return line items in different order sometimes making this test a bit flaky. The test passed on Semaphore previously and is passing in development. I don't think the order matters so using :match_array instead of :eq.
@cillian
Copy link
Contributor Author

cillian commented Aug 28, 2020

@filipefurtad0 thanks, sorry I missed that. That should be fixed now, I also added extra tests.

@luisramos0
Copy link
Contributor

👍 I think one re-review is enough. moving back to test ready.

@filipefurtad0 filipefurtad0 added the pr-staged-uk staging.openfoodnetwork.org.uk label Sep 1, 2020
@filipefurtad0
Copy link
Contributor

Hey @cillian ,

This looks great now:

image

image

image

image

CSV files are created accordingly.

Thank you so much 👍
Moving this to Ready to Go.

@filipefurtad0 filipefurtad0 removed the pr-staged-uk staging.openfoodnetwork.org.uk label Sep 1, 2020
@luisramos0 luisramos0 merged commit ea05355 into openfoodfoundation:master Sep 1, 2020
@cillian cillian deleted the bulk-coop-report-filter-fixes branch September 17, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date selector and Distributor ID filters don't work on Bulk Co-op report
4 participants