mirror of
https://github.com/adityachandelgit/BookLore.git
synced 2026-02-09 11:14:37 -06:00
Feature/update date finished integration (#895)
* Fixed issue with not updating the book finished date when updating read status * Added ability to set a date finished after setting the book status to Read. --------- Co-authored-by: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com>
This commit is contained in:
@@ -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;
|
||||
return epubProgress != null || pdfProgress != null || cbxProgress != null || dateFinished != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,9 +312,12 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user