Merge pull request #3478 from omnivore-app/fix/reduce-reading-progress

Use the DB stored reading progress when calculating maxes
This commit is contained in:
Jackson Harper 2024-02-01 16:52:46 +08:00 committed by GitHub
commit fe5d986e91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -171,7 +171,10 @@ const readingProgressHandlers = {
article.id article.id
) )
if (readingProgress) { if (readingProgress) {
return readingProgress.readingProgressPercent return Math.max(
article.readingProgressPercent ?? 0,
readingProgress.readingProgressPercent
)
} }
} }
return article.readingProgressPercent return article.readingProgressPercent
@ -187,8 +190,11 @@ const readingProgressHandlers = {
ctx.claims?.uid, ctx.claims?.uid,
article.id article.id
) )
if (readingProgress) { if (readingProgress && readingProgress.readingProgressAnchorIndex) {
return readingProgress.readingProgressAnchorIndex return Math.max(
article.readingProgressAnchorIndex ?? 0,
readingProgress.readingProgressAnchorIndex
)
} }
} }
return article.readingProgressAnchorIndex return article.readingProgressAnchorIndex
@ -204,8 +210,11 @@ const readingProgressHandlers = {
ctx.claims?.uid, ctx.claims?.uid,
article.id article.id
) )
if (readingProgress) { if (readingProgress && readingProgress.readingProgressTopPercent) {
return readingProgress.readingProgressTopPercent return Math.max(
article.readingProgressTopPercent ?? 0,
readingProgress.readingProgressTopPercent
)
} }
} }
return article.readingProgressTopPercent return article.readingProgressTopPercent