do not update library item score if 0

This commit is contained in:
Hongbo Wu 2024-07-01 11:51:57 +08:00
parent 6bb11ce99b
commit 9f7065c5c3

View file

@ -97,24 +97,22 @@ export const scoreLibraryItem = async (
items: itemFeatures,
})
logger.info('Scores', scores)
const score = scores[libraryItem.id]['score']
const score = scores[libraryItem.id].score
if (!score) {
logger.error('Failed to score library item', data)
throw new Error('Failed to score library item')
} else {
await updateLibraryItem(
libraryItem.id,
{
score,
},
userId,
undefined,
true
)
logger.info('Library item score updated', data)
}
await updateLibraryItem(
libraryItem.id,
{
score,
},
userId,
undefined,
true
)
logger.info('Library item scored', data)
try {
await enqueueUpdateHomeJob({
userId,