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

Maintain date range values in the report forms #11732

Merged

Conversation

yasirazgar
Copy link
Contributor

@yasirazgar yasirazgar commented Oct 28, 2023

What? Why?

Date range selection needs to maintained after form submission

What should we test?

customer.mov
customer.pack.mov

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

Copy link
Collaborator

@rioug rioug 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 ! Thanks for your help 🙏

Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

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

Thank you, this is great!

Comment on lines +4 to +5
- start_date ||= params[:q].try(:[], :completed_at_gt)
- end_date ||= params[:q].try(:[], :completed_at_lt)
Copy link
Member

Choose a reason for hiding this comment

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

Hashes have a nice fail-safe method to access values that may be there:

Suggested change
- start_date ||= params[:q].try(:[], :completed_at_gt)
- end_date ||= params[:q].try(:[], :completed_at_lt)
- start_date ||= params.dig(:q, :completed_at_gt)
- end_date ||= params.dig(:q], :completed_at_lt)

@drummer83 drummer83 changed the title 11612 - Maintain date range values in the forms Maintain date range values in the report forms Nov 21, 2023
@drummer83 drummer83 self-assigned this Nov 21, 2023
@drummer83 drummer83 added the pr-staged-au staging.openfoodnetwork.org.au label Nov 21, 2023
@drummer83
Copy link
Contributor

Hi @yasirazgar,
Thank you so much for this pull request and sorry for the slow testing process!

I have staged your PR to one of our servers an compared before and after. I found that before staging the Customers report as well as the Enterprise Fee Summary report were not keeping the date selection. All other reports did.

Before staging

Customers report after clicking 'Go':
grafik

Enterprise Fee Summary report after clicking 'Go':
grafik

After staging

Customers report after clicking 'Go':
grafik

Enterprise Fee Summary report after clicking 'Go':
grafik

We can see that the date selection is now kept. 💪

I have also checked that

  • all other report are still keeping the date range,
  • reloading the report clears the date range (and all other settings),
  • no errors are logged in Bugsnag.

Results

Excellent! I couldn't find any issue with this pull request! 🥳
I will go ahead and merge this one! 🚀

Thanks again!

@drummer83 drummer83 merged commit 40f5fad into openfoodfoundation:master Nov 21, 2023
52 checks passed
@drummer83 drummer83 removed the pr-staged-au staging.openfoodnetwork.org.au label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Reports] Customers report doesn't keep the date range selection
4 participants