Include image total O-Count on stats page (#4386)

This commit is contained in:
DingDongSoLong4
2023-12-21 07:19:41 +02:00
committed by GitHub
parent e304d981d0
commit d0d0d1e11f
4 changed files with 116 additions and 19 deletions

View File

@@ -551,6 +551,18 @@ func (qb *ImageStore) OCountByPerformerID(ctx context.Context, performerID int)
return ret, nil
}
func (qb *ImageStore) OCount(ctx context.Context) (int, error) {
table := qb.table()
q := dialect.Select(goqu.COALESCE(goqu.SUM("o_counter"), 0)).From(table)
var ret int
if err := querySimple(ctx, q, &ret); err != nil {
return 0, err
}
return ret, nil
}
func (qb *ImageStore) FindByFolderID(ctx context.Context, folderID models.FolderID) ([]*models.Image, error) {
table := qb.table()
fileTable := goqu.T(fileTable)