fix: Ratings UI and Filter Issues #3459
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
(REQUIRED)
What this PR does / why we need it:
(REQUIRED)
This PR fixes two issues with the new user ratings:
RecipeRating
ComponentThere are various quirks with setting ratings when the group rating matches the desired user rating For instance, if the group rating is 4, and you want to set your user rating to 4, the UI interprets this as you setting it to 0.
Now we use two
v-rating
components to achieve the same effect, which greatly simplifies the logic (and removes the same-rating edge case).Sort Recipes By Rating
The rating sort on the home page can be jank depending on database-specific handling (e.g. I think postgres defaults to "nulls first" and sqlite defaults to "nulls last", or something like that) so I made the null handling explicitly nulls last (unless overridden with a query param).
I also coalesced 0 values to null, since currently they are equivalent (you can't rate something 0, you can only remove your rating).
Which issue(s) this PR fixes:
(REQUIRED)
N/A
Testing
(fill-in or delete this section)
Manual frontend testing