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

Price API: Allow filter on product categories tags #673

Closed
TTalex opened this issue Jan 11, 2025 · 2 comments · Fixed by #676 · May be fixed by #675
Closed

Price API: Allow filter on product categories tags #673

TTalex opened this issue Jan 11, 2025 · 2 comments · Fixed by #676 · May be fixed by #675
Labels

Comments

@TTalex
Copy link
Collaborator

TTalex commented Jan 11, 2025

Problem

I would like to fetch prices matching a specific product category, for example "en:hazelnut-spreads".

Currently, the API only allows filtering on category_tag for products without a barcode (and thus no product relation)

Proposed solution

Add a product_categories_tags__contains filter

@raphodn
Copy link
Member

raphodn commented Jan 11, 2025

Ah, N+1 queries 😁
in the price views.py we already have a select_related so it shouldn't have too much of an impact.

But to be on the safe side I'd rather

  • have this in a seperate PR
  • add 1-2 tests that use assertNumQueries
  • rename to product__categories_tags__contains to show the relationship

@TTalex
Copy link
Collaborator Author

TTalex commented Jan 12, 2025

I created said PR, but I could use your help writing the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants