Fix library stats returning null instead of 0 #4251

This commit is contained in:
advplyr 2025-05-03 17:25:01 -05:00
parent 1a1ef9c378
commit 45987ffd63
2 changed files with 10 additions and 3 deletions

View File

@ -1247,7 +1247,12 @@ module.exports = {
libraryId libraryId
} }
}) })
return statResults[0] return {
totalSize: statResults?.[0]?.totalSize || 0,
totalDuration: statResults?.[0]?.totalDuration || 0,
numAudioFiles: statResults?.[0]?.numAudioFiles || 0,
totalItems: statResults?.[0]?.totalItems || 0
}
}, },
/** /**

View File

@ -533,8 +533,10 @@ module.exports = {
} }
}) })
return { return {
...statResults[0], totalDuration: statResults?.[0]?.totalDuration || 0,
totalSize: sizeResults[0].totalSize || 0 numAudioFiles: statResults?.[0]?.numAudioFiles || 0,
totalItems: statResults?.[0]?.totalItems || 0,
totalSize: sizeResults?.[0]?.totalSize || 0
} }
}, },