mirror of
https://github.com/gotson/komga.git
synced 2025-12-07 17:13:59 +01:00
fix(api): read progress modified time could be inaccurate in some cases
This commit is contained in:
parent
623b2e3687
commit
6c3565caa8
1 changed files with 4 additions and 4 deletions
|
|
@ -34,7 +34,6 @@ import org.gotson.komga.infrastructure.hash.Hasher
|
|||
import org.gotson.komga.infrastructure.hash.KoreaderHasher
|
||||
import org.gotson.komga.infrastructure.image.ImageConverter
|
||||
import org.gotson.komga.infrastructure.image.ImageType
|
||||
import org.gotson.komga.language.toCurrentTimeZone
|
||||
import org.springframework.beans.factory.annotation.Qualifier
|
||||
import org.springframework.context.ApplicationEventPublisher
|
||||
import org.springframework.data.domain.Pageable
|
||||
|
|
@ -43,6 +42,7 @@ import org.springframework.transaction.support.TransactionTemplate
|
|||
import org.springframework.web.util.UriUtils
|
||||
import java.io.File
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
import kotlin.io.path.deleteIfExists
|
||||
import kotlin.io.path.exists
|
||||
import kotlin.io.path.isWritable
|
||||
|
|
@ -458,8 +458,8 @@ class BookLifecycle(
|
|||
readProgressRepository.findByBookIdAndUserIdOrNull(book.id, user.id)?.let { savedProgress ->
|
||||
check(
|
||||
newProgression.modified
|
||||
.withZoneSameInstant(ZoneId.systemDefault())
|
||||
.toLocalDateTime()
|
||||
.toCurrentTimeZone()
|
||||
.isAfter(savedProgress.readDate),
|
||||
) { "Progression is older than existing" }
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ class BookLifecycle(
|
|||
user.id,
|
||||
newProgression.locator.locations!!.position!!,
|
||||
newProgression.locator.locations.position == media.pageCount,
|
||||
newProgression.modified.toLocalDateTime().toCurrentTimeZone(),
|
||||
newProgression.modified.withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime(),
|
||||
newProgression.device.id,
|
||||
newProgression.device.name,
|
||||
newProgression.locator,
|
||||
|
|
@ -518,7 +518,7 @@ class BookLifecycle(
|
|||
user.id,
|
||||
totalProgression?.let { (media.pageCount * it).roundToInt() } ?: 0,
|
||||
totalProgression?.let { it >= 0.99F } ?: false,
|
||||
newProgression.modified.toLocalDateTime().toCurrentTimeZone(),
|
||||
newProgression.modified.withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime(),
|
||||
newProgression.device.id,
|
||||
newProgression.device.name,
|
||||
newProgression.locator.copy(
|
||||
|
|
|
|||
Loading…
Reference in a new issue