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

Use distinct to return unique product list for scope visible_for #8471

Conversation

jibees
Copy link
Contributor

@jibees jibees commented Nov 10, 2021

What? Why?

Product were displayed twice (or more) in certain condition under order cycle incoming products admin interface

Closes #7885

What should we test?

  1. Create a product with n variants, with n > 1
  2. Add it to the inventory
  3. Add it to an OC
  4. Under "Advanced Settings" choose the option "Coordinators inventory only"
  5. See this product appears 1 time in the incoming section of the OC -> notice the loaded variant count is also correct (xx / yy Variants Loaded where xx < yy)

Release notes

Remove duplicate product under incoming products section of an order cycle under certain conditions

Changelog Category: User facing changes

 - Product were displayed twice (or more) in certain condition under order cycle incoming products admin interface
@jibees jibees self-assigned this Nov 10, 2021
@jibees jibees changed the title Use distinct to return unique product Use distinct to return unique product list for scope visible_for Nov 10, 2021
@jibees jibees marked this pull request as ready for review November 10, 2021 14:21
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.

No spec?

A unit test in the product_spec.rb file would be enough, I think.

@jibees
Copy link
Contributor Author

jibees commented Nov 12, 2021

No spec?

A unit test in the product_spec.rb file would be enough, I think.

Right: fff2c3a !

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.

😄

@filipefurtad0 filipefurtad0 self-assigned this Nov 15, 2021
@filipefurtad0 filipefurtad0 added the pr-staged-uk staging.openfoodnetwork.org.uk label Nov 15, 2021
@filipefurtad0
Copy link
Contributor

Hey @jibees ,

Before this PR the behavior is as described in #7885:

image

After this PR, OC which should show inventory only variants appear correctly:

image

Regression tested:

  • adding variants to OC with "all products" option selected
  • adding variants to OC with "coordinator's inventory only"
  • checked whether these appear as expected in the shop front

All good, good to go 👍

@filipefurtad0 filipefurtad0 removed the pr-staged-uk staging.openfoodnetwork.org.uk label Nov 15, 2021
@Matt-Yorkley Matt-Yorkley merged commit b388196 into openfoodfoundation:master Nov 15, 2021
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.

Product appearing twice in the "Incoming" section of order-cycles
4 participants