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