mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
[Files Refactor] bug fixes (#2811)
* Fix scan options not saving * Fix duration stat calculation
This commit is contained in:
@@ -63,7 +63,7 @@ func (s *Manager) ScanSubscribe(ctx context.Context) <-chan bool {
|
|||||||
type ScanMetadataInput struct {
|
type ScanMetadataInput struct {
|
||||||
Paths []string `json:"paths"`
|
Paths []string `json:"paths"`
|
||||||
|
|
||||||
config.ScanMetadataOptions
|
config.ScanMetadataOptions `mapstructure:",squash"`
|
||||||
|
|
||||||
// Filter options for the scan
|
// Filter options for the scan
|
||||||
Filter *ScanMetaDataFilterInput `json:"filter"`
|
Filter *ScanMetaDataFilterInput `json:"filter"`
|
||||||
|
|||||||
@@ -642,7 +642,18 @@ func (qb *SceneStore) Size(ctx context.Context) (float64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (qb *SceneStore) Duration(ctx context.Context) (float64, error) {
|
func (qb *SceneStore) Duration(ctx context.Context) (float64, error) {
|
||||||
q := dialect.Select(goqu.SUM(qb.queryTable().Col("duration"))).From(qb.queryTable())
|
table := qb.table()
|
||||||
|
videoFileTable := videoFileTableMgr.table
|
||||||
|
|
||||||
|
q := dialect.Select(
|
||||||
|
goqu.SUM(videoFileTable.Col("duration"))).From(table).InnerJoin(
|
||||||
|
scenesFilesJoinTable,
|
||||||
|
goqu.On(scenesFilesJoinTable.Col("scene_id").Eq(table.Col(idColumn))),
|
||||||
|
).InnerJoin(
|
||||||
|
videoFileTable,
|
||||||
|
goqu.On(videoFileTable.Col("file_id").Eq(scenesFilesJoinTable.Col("file_id"))),
|
||||||
|
)
|
||||||
|
|
||||||
var ret float64
|
var ret float64
|
||||||
if err := querySimple(ctx, q, &ret); err != nil {
|
if err := querySimple(ctx, q, &ret); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|||||||
Reference in New Issue
Block a user