Skip to content
New issue

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

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

Already on GitHub? # to your account

Add customer code to notify producer emails when enabled #13012

Conversation

chahmedejaz
Copy link
Collaborator

@chahmedejaz chahmedejaz commented Dec 2, 2024

⚠️ Please use clockify code #12476 Flower Farms

What? Why?

What should we test?

  • As mentioned in the issue

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

To test the text version of the report, this PR needs to be merged first:

However, the respective changes are also incorporated in the text version as well.

@chahmedejaz chahmedejaz added the user facing changes Thes pull requests affect the user experience label Dec 2, 2024
@chahmedejaz chahmedejaz changed the title Task/13007 customer code in order cycle email Add customer code to notify producer emails when enabled Dec 2, 2024
@chahmedejaz chahmedejaz force-pushed the task/13007-customer-code-in-order-cycle-email branch from 312d097 to 604a47b Compare December 10, 2024 00:51
line_items.map do |line_item|
customer_code = line_item.order.customer&.code
@display_business_name = true if customer_code.present?
Copy link
Collaborator Author

@chahmedejaz chahmedejaz Dec 10, 2024

Choose a reason for hiding this comment

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

We only want to show the business name column if at least one customer has the code present. ref

@chahmedejaz chahmedejaz marked this pull request as ready for review December 10, 2024 01:00
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.

Simple logic, well done.

I don't like the conditional display of the column. But I wasn't part of the shaping phase here. No big deal anyway. 👍

@rioug rioug self-requested a review December 10, 2024 22:48
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 👍

@filipefurtad0 filipefurtad0 self-assigned this Dec 13, 2024
@filipefurtad0 filipefurtad0 added pr-staged-au staging.openfoodnetwork.org.au and removed pr-staged-au staging.openfoodnetwork.org.au labels Dec 13, 2024
@filipefurtad0
Copy link
Contributor

Hey @chahmedejaz ,

I've verified that:

  • with the customer names option disabled (admin/enterprises/<enterprise_name>/edit#/shop_preferences_panel) -> we get the email as before, i.e., no new section with customer last and first names
  • with the customer names option enabled, we get:

For the hub:
image

For the producer:
image

Perhaps the indentation could be improved, not sure - it does not compromise reading, so I'd say this is good to go!

Merging.
🚀

@filipefurtad0 filipefurtad0 merged commit 9bfac66 into openfoodfoundation:master Dec 13, 2024
54 of 55 checks passed
@filipefurtad0 filipefurtad0 removed the pr-staged-au staging.openfoodnetwork.org.au label Dec 13, 2024
@chahmedejaz
Copy link
Collaborator Author

chahmedejaz commented Dec 14, 2024

Hi @filipefurtad0 - Just to confirm, were you able to view the business name column if any of the mentioned customers had customer code present? The column is hidden if it's not present for any of the mentioned customers.
Just confirming because the above screenshots are missing the business name column 😅.

@filipefurtad0
Copy link
Contributor

Many thanks for spotting that missing test case @chahmedejaz - by bad, for skipping that one.

I've edited the customer code from an existing customer, and also edited the First and Last names. This was done on the /customers page, as a hub manager:

image

Then, I've placed a new order, for that customer and triggered the order cycle producer email.

I can verify that if the customer has a customer code, the column is displayed together with the corresponding customer name:

image

I've noticed that changes made on the customer data - like, editing the customer first- and last-name - were not reflected on the email. I'd say this is expected, as the changes on the /customers page (by the distributor) should not change data on the order level and the information sent to the producer.

This looks good to me 🟢

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
user facing changes Thes pull requests affect the user experience
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add customer code to notify producer emails when enabled
4 participants