Skip to content

Commit

Permalink
allow setting createdAt and respect set finishedAt when syncing progress
Browse files Browse the repository at this point in the history
  • Loading branch information
justcallmelarry committed Oct 22, 2024
1 parent 9896e43 commit 9b01d11
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,13 +607,14 @@ class User extends Model {
ebookLocation: progressPayload.ebookLocation || null,
ebookProgress: isNullOrNaN(progressPayload.ebookProgress) ? 0 : Number(progressPayload.ebookProgress),
finishedAt: progressPayload.finishedAt || null,
createdAt: progressPayload.createdAt || new Date(),
extraData: {
libraryItemId: progressPayload.libraryItemId,
progress: isNullOrNaN(progressPayload.progress) ? 0 : Number(progressPayload.progress)
}
}
if (newMediaProgressPayload.isFinished) {
newMediaProgressPayload.finishedAt = new Date()
newMediaProgressPayload.finishedAt = newMediaProgressPayload.finishedAt || new Date()
newMediaProgressPayload.extraData.progress = 1
} else {
newMediaProgressPayload.finishedAt = null
Expand Down

0 comments on commit 9b01d11

Please sign in to comment.