mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Group O-Counter Filter/Sort (#6122)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user