Skip to content

fix: added missing favorite and times_cooked keys to allowed sort ord… - #4722

Open
Abhijay-29r wants to merge 1 commit into
TandoorRecipes:developfrom
Abhijay-29r:develop
Open

fix: added missing favorite and times_cooked keys to allowed sort ord…#4722
Abhijay-29r wants to merge 1 commit into
TandoorRecipes:developfrom
Abhijay-29r:develop

Conversation

@Abhijay-29r

Copy link
Copy Markdown

Description

This PR fixes a breaking regression where sorting recipes by favorite, -favorite, or times_cooked results in a 500 ValueError: Invalid sort key error.

Changes Made

  • Added 'favorite' and '-favorite' to ALLOWED_KEYS inside _finalize_ordering.
  • Added 'times_cooked' to _NULLS_LAST to properly manage blank values.
  • Added the missing .with_times_cooked(user, space) annotation logic inside get_queryset so the database properly recognizes the field when ordering.

Closes #4720

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Breaking regression on sort_order list and ALLOWED_KEYS

2 participants