Fix audiobook progress percentage calculation
This commit is contained in:
@@ -376,7 +376,7 @@ public interface ReadingSessionRepository extends JpaRepository<ReadingSessionEn
|
||||
MAX(CONVERT_TZ(rs.end_time, '+00:00', :tzOffset)) as lastSessionDate,
|
||||
COUNT(*) as totalSessions,
|
||||
COALESCE(SUM(rs.duration_seconds), 0) as totalDurationSeconds,
|
||||
COALESCE(MAX(rs.end_progress), 0) as maxProgress,
|
||||
COALESCE(MAX(rs.end_progress), 0) / 100.0 as maxProgress,
|
||||
ubp.read_status as readStatus
|
||||
FROM reading_sessions rs
|
||||
JOIN book b ON rs.book_id = b.id
|
||||
|
||||
@@ -662,7 +662,7 @@ public class ReadingSessionService {
|
||||
inProgress.add(ListeningCompletionResponse.AudiobookCompletionEntry.builder()
|
||||
.bookId(dto.getBookId())
|
||||
.title(dto.getTitle())
|
||||
.progressPercent(Math.round(maxProg * 1000.0) / 10.0)
|
||||
.progressPercent(Math.round(maxProg * 10.0) / 10.0)
|
||||
.totalDurationSeconds(dto.getTotalDurationSeconds() != null ? dto.getTotalDurationSeconds() : 0L)
|
||||
.listenedDurationSeconds(dto.getListenedDurationSeconds() != null ? dto.getListenedDurationSeconds() : 0L)
|
||||
.build());
|
||||
@@ -820,7 +820,7 @@ public class ReadingSessionService {
|
||||
.title(dto.getTitle())
|
||||
.totalDurationSeconds(dto.getTotalDurationSeconds() != null ? dto.getTotalDurationSeconds() : 0L)
|
||||
.listenedDurationSeconds(dto.getListenedDurationSeconds() != null ? dto.getListenedDurationSeconds() : 0L)
|
||||
.progressPercent(Math.round(maxProg * 1000.0) / 10.0)
|
||||
.progressPercent(Math.round(maxProg * 10.0) / 10.0)
|
||||
.build();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Reference in New Issue
Block a user