From 9dc5110169dad91a1fdbdb581684524af997d536 Mon Sep 17 00:00:00 2001 From: ACX <8075870+acx10@users.noreply.github.com> Date: Tue, 20 Jan 2026 09:57:59 -0700 Subject: [PATCH] Normalize book progress percentage rounding (#2359) Co-authored-by: acx10 --- .../booklore/service/book/BookUpdateService.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/service/book/BookUpdateService.java b/booklore-api/src/main/java/com/adityachandel/booklore/service/book/BookUpdateService.java index ce6b508b2..18552d9f9 100644 --- a/booklore-api/src/main/java/com/adityachandel/booklore/service/book/BookUpdateService.java +++ b/booklore-api/src/main/java/com/adityachandel/booklore/service/book/BookUpdateService.java @@ -277,21 +277,28 @@ public class BookUpdateService { private Float updateEbookProgress(UserBookProgressEntity progress, EpubProgress epubProgress) { if (epubProgress == null) return null; + progress.setEpubProgress(epubProgress.getCfi()); progress.setEpubProgressHref(epubProgress.getHref()); - return epubProgress.getPercentage(); + + float percentage = epubProgress.getPercentage(); + return Math.round(percentage * 10f) / 10f; } private Float updatePdfProgress(UserBookProgressEntity progress, PdfProgress pdfProgress) { if (pdfProgress == null) return null; + progress.setPdfProgress(pdfProgress.getPage()); - return pdfProgress.getPercentage(); + float percentage = pdfProgress.getPercentage(); + return Math.round(percentage * 10f) / 10f; } private Float updateCbxProgress(UserBookProgressEntity progress, CbxProgress cbxProgress) { if (cbxProgress == null) return null; + progress.setCbxProgress(cbxProgress.getPage()); - return cbxProgress.getPercentage(); + float percentage = cbxProgress.getPercentage(); + return Math.round(percentage * 10f) / 10f; } private void updateExistingProgress(Long userId, Set bookIds, ReadStatus status, Instant now, Instant dateFinished) {