Enhanced book "Finished On" functionality
This commit is contained in:
+1
-1
@@ -19,6 +19,6 @@ public class ReadProgressRequest {
|
||||
|
||||
@AssertTrue(message = "At least one progress field must be provided")
|
||||
public boolean isProgressValid() {
|
||||
return epubProgress != null || pdfProgress != null || cbxProgress != null || dateFinished != null;
|
||||
return epubProgress != null || pdfProgress != null || cbxProgress != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,12 +312,9 @@ public class BookService {
|
||||
userBookProgress.setCbxProgress(request.getCbxProgress().getPage());
|
||||
userBookProgress.setCbxProgressPercent(request.getCbxProgress().getPercentage());
|
||||
}
|
||||
|
||||
// Update dateFinished if provided
|
||||
if (request.getDateFinished() != null) {
|
||||
userBookProgress.setDateFinished(request.getDateFinished());
|
||||
}
|
||||
|
||||
userBookProgressRepository.save(userBookProgress);
|
||||
}
|
||||
|
||||
@@ -340,7 +337,7 @@ public class BookService {
|
||||
progress.setUser(userEntity);
|
||||
progress.setBook(book);
|
||||
progress.setReadStatus(readStatus);
|
||||
|
||||
|
||||
// Set dateFinished when status is READ, clear it otherwise
|
||||
if (readStatus == ReadStatus.READ) {
|
||||
progress.setDateFinished(Instant.now());
|
||||
|
||||
Reference in New Issue
Block a user