Fix issue with “unset” read status handling (#1669)
This commit is contained in:
@@ -8,5 +8,6 @@ public enum ReadStatus {
|
||||
PARTIALLY_READ,
|
||||
PAUSED,
|
||||
WONT_READ,
|
||||
ABANDONED
|
||||
ABANDONED,
|
||||
UNSET
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class BookService {
|
||||
.percentage(progress.getKoboProgressPercent())
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
switch (book.getBookType()) {
|
||||
case EPUB -> {
|
||||
book.setEpubProgress(EpubProgress.builder()
|
||||
@@ -96,7 +96,7 @@ public class BookService {
|
||||
if (progress != null) {
|
||||
setBookProgress(book, progress);
|
||||
book.setLastReadTime(progress.getLastReadTime());
|
||||
book.setReadStatus(String.valueOf(progress.getReadStatus()));
|
||||
book.setReadStatus(progress.getReadStatus() == null ? String.valueOf(ReadStatus.UNSET) : String.valueOf(progress.getReadStatus()));
|
||||
book.setDateFinished(progress.getDateFinished());
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public class BookService {
|
||||
.build());
|
||||
}
|
||||
book.setFilePath(FileUtils.getBookFullPath(bookEntity));
|
||||
book.setReadStatus(String.valueOf(userProgress.getReadStatus()));
|
||||
book.setReadStatus(userProgress.getReadStatus() == null ? String.valueOf(ReadStatus.UNSET) : String.valueOf(userProgress.getReadStatus()));
|
||||
book.setDateFinished(userProgress.getDateFinished());
|
||||
|
||||
if (!withDescription) {
|
||||
@@ -408,7 +408,6 @@ public class BookService {
|
||||
progress.setBook(book);
|
||||
progress.setReadStatus(readStatus);
|
||||
|
||||
// Set dateFinished when status is READ, clear it otherwise
|
||||
if (readStatus == ReadStatus.READ) {
|
||||
progress.setDateFinished(Instant.now());
|
||||
} else {
|
||||
@@ -430,7 +429,7 @@ public class BookService {
|
||||
if (progress != null) {
|
||||
setBookProgress(book, progress);
|
||||
book.setLastReadTime(progress.getLastReadTime());
|
||||
book.setReadStatus(String.valueOf(progress.getReadStatus()));
|
||||
book.setReadStatus(progress.getReadStatus() == null ? String.valueOf(ReadStatus.UNSET) : String.valueOf(progress.getReadStatus()));
|
||||
book.setDateFinished(progress.getDateFinished());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user