Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: add rating and sort by rating feature to tags#7025

Open
slick-daddy wants to merge 8 commits into
stashapp:developstashapp/stash:developfrom
slick-daddy:tag-ratingslick-daddy/stash:tag-ratingCopy head branch name to clipboard
Open

feat: add rating and sort by rating feature to tags#7025
slick-daddy wants to merge 8 commits into
stashapp:developstashapp/stash:developfrom
slick-daddy:tag-ratingslick-daddy/stash:tag-ratingCopy head branch name to clipboard

Conversation

@slick-daddy

@slick-daddy slick-daddy commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description

Added full rating support for tags, bringing them in line with other entities like scenes, performers, and studios.

Changes

Database

Added a rating column (tinyint) to the tags table via a new migration (86_tag_rating.up.sql), bumping the schema version to 86. Ratings are stored on a 0–100 scale, consistent with the rest of the application.

Backend

  • Added a Rating field to the Tag and TagPartial model structs, storing the value on a 0–100 scale
  • Exposed the rating on the GraphQL API as rating100 on the Tag type and the TagCreateInput, TagUpdateInput, and BulkTagUpdateInput inputs, matching the naming used by scenes, performers, and studios
  • Wired the rating100 input through the TagCreate, TagUpdate, and BulkTagUpdate mutation resolvers, and added a Rating100 field resolver that maps the GraphQL rating100 field to the model's Rating
  • Added the rating column to the sqlite tag row mapping (read, write, and partial update)
  • Added rating100 to the GraphQL TagFilterType schema and wired it to the tags.rating column in the SQL filter handler in tag_filter.go, enabling tags to be queried by rating
  • Added rating as a tag sort option, sorted via the shared sort handler
  • Added tag rating to import/export (pkg/tag/export.go, pkg/tag/import.go)
  • Regenerated GraphQL types via go generate
  • Added integration tests for updating, querying/filtering, and sorting by rating, and seeded ratings into the tag test fixtures so the filter and sort tests exercise real data

Frontend

  • Added rating100 to the TagData, SelectTagData, and TagListData GraphQL fragments
  • Added an editable rating to the tag detail and edit panels (TagDetailsPanel, TagEditPanel), including the compressed detail header
  • Added a rating banner to TagCard and an inline click-to-rate rating column to the tag list table (TagListTable)
  • Added a rating sidebar filter and a "rating" sort option to the tag list (TagList.tsx, models/list-filter/tags.ts)
  • Added FindTagDocument to tagMutationImpactedQueries so the tag detail page refetches after a rating change
  • Regenerated GraphQL types via gqlgen

Related Issue

Related #6564, closes the longstanding #1400

Testing

  • Add any rating to any tag. It can be done after clicking Edit button on specific tag page as well.
  • It gets rating.
  • Rated tags can be sorted and filtered.
  • Rating column can be seen if switched to list view for tags.

Checklist

  • I have read and understood the Contributing document.
  • I have read and understood the AI Usage Policy document.
  • I have made corresponding changes to the documentation (if applicable).

AI Usage Disclosure

  • I have used AI tools to assist with this pull request, and I have disclosed the tools and how I used them below.
    SWE 1.6 pro used for draft. Tests are written by AI. Review by me and some fixes found with Claude.

Additional Context

TagPartial Struct
TagPartial is used by UpdatePartial to perform partial updates — only fields explicitly set (via OptionalInt) are written to the database. Rating is included on TagPartial, not just Tag, so that rating-only edits (e.g. clicking a star in the list view) persist without requiring the client to resend other tag fields.

@slick-daddy
slick-daddy marked this pull request as ready for review June 11, 2026 04:38
@WithoutPants

Copy link
Copy Markdown
Collaborator

Needs import/export support.

slick-daddy and others added 5 commits June 12, 2026 02:15
TestTagQueryRating100 iterated over query results to assert the rating
filter, but createTags never set a rating, so every fixture tag had a
NULL rating and the assertion loop ran zero iterations for the Equals,
NotEquals, GreaterThan, and LessThan modifiers. The test passed without
exercising the filter.

Seed ratings the same way createPerformers and createScenes do, via
getRating(index)/getIntPtr, so the existing verifyTagsRating100 checks
run against real data and would catch a regression in the filter.
Remove the explicit case "rating" in getTagSort. The default branch's
getSort already produces "ORDER BY tags.rating <dir>" for sort="rating",
matching how studios and performers sort by rating. Add a rating case to
TestTagQuerySort to guard the equivalence.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.