Fix stats page SUM error (#4390)

This commit is contained in:
DingDongSoLong4 2023-12-22 12:40:05 +02:00 committed by GitHub
parent e1782d094d
commit 0cdea209bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -622,7 +622,7 @@ func (qb *ImageStore) Size(ctx context.Context) (float64, error) {
table := qb.table()
fileTable := fileTableMgr.table
q := dialect.Select(
goqu.SUM(fileTableMgr.table.Col("size")),
goqu.COALESCE(goqu.SUM(fileTableMgr.table.Col("size")), 0),
).From(table).InnerJoin(
imagesFilesJoinTable,
goqu.On(table.Col(idColumn).Eq(imagesFilesJoinTable.Col(imageIDColumn))),

View File

@ -779,7 +779,7 @@ func (qb *SceneStore) Size(ctx context.Context) (float64, error) {
table := qb.table()
fileTable := fileTableMgr.table
q := dialect.Select(
goqu.SUM(fileTableMgr.table.Col("size")),
goqu.COALESCE(goqu.SUM(fileTableMgr.table.Col("size")), 0),
).From(table).InnerJoin(
scenesFilesJoinTable,
goqu.On(table.Col(idColumn).Eq(scenesFilesJoinTable.Col(sceneIDColumn))),
@ -800,7 +800,8 @@ func (qb *SceneStore) Duration(ctx context.Context) (float64, error) {
videoFileTable := videoFileTableMgr.table
q := dialect.Select(
goqu.SUM(videoFileTable.Col("duration"))).From(table).InnerJoin(
goqu.COALESCE(goqu.SUM(videoFileTable.Col("duration")), 0),
).From(table).InnerJoin(
scenesFilesJoinTable,
goqu.On(scenesFilesJoinTable.Col("scene_id").Eq(table.Col(idColumn))),
).InnerJoin(