Enhanced book "Finished On" functionality

This commit is contained in:
aditya.chandel
2025-08-11 22:23:07 -06:00
parent 53aae8bb42
commit c3b2940f36
3 changed files with 49 additions and 46 deletions
@@ -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());