Group O-Counter Filter/Sort (#6122)

This commit is contained in:
EventHoriizon
2025-11-10 00:53:53 +00:00
committed by GitHub
parent 2e766952dd
commit d5b1046267
12 changed files with 128 additions and 0 deletions

View File

@@ -488,6 +488,7 @@ var groupSortOptions = sortOptions{
"random",
"rating",
"scenes_count",
"o_counter",
"sub_group_order",
"tag_count",
"updated_at",
@@ -524,6 +525,8 @@ func (qb *GroupStore) setGroupSort(query *queryBuilder, findFilter *models.FindF
query.sortAndPagination += getCountSort(groupTable, groupsTagsTable, groupIDColumn, direction)
case "scenes_count": // generic getSort won't work for this
query.sortAndPagination += getCountSort(groupTable, groupsScenesTable, groupIDColumn, direction)
case "o_counter":
query.sortAndPagination += qb.sortByOCounter(direction)
default:
query.sortAndPagination += getSort(sort, direction, "groups")
}
@@ -701,3 +704,8 @@ func (qb *GroupStore) FindInAncestors(ctx context.Context, ascestorIDs []int, id
return ret, nil
}
func (qb *GroupStore) sortByOCounter(direction string) string {
// need to sum the o_counter from scenes and images
return " ORDER BY (" + selectGroupOCountSQL + ") " + direction
}