fix: Reading stats UI (#2322)
* part1 fix: reading days show duration * part2 fix: Fix time formatting in favorite days chart --------- Co-authored-by: WorldTeacher <coding_contact@pm.me>
This commit is contained in:
co-authored by
WorldTeacher
parent
ecdb58c11f
commit
6338ed13fc
+1
-1
@@ -84,7 +84,7 @@ public interface ReadingSessionRepository extends JpaRepository<ReadingSessionEn
|
||||
SELECT
|
||||
DAYOFWEEK(rs.startTime) as dayOfWeek,
|
||||
COUNT(rs) as sessionCount,
|
||||
SUM(rs.durationSeconds) as totalDurationSeconds
|
||||
COALESCE(SUM(rs.durationSeconds), 0) as totalDurationSeconds
|
||||
FROM ReadingSessionEntity rs
|
||||
WHERE rs.user.id = :userId
|
||||
AND (:year IS NULL OR YEAR(rs.startTime) = :year)
|
||||
|
||||
+2
-2
@@ -90,8 +90,8 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
if (label === 'Sessions') {
|
||||
return `${label}: ${value} session${value !== 1 ? 's' : ''}`;
|
||||
} else {
|
||||
const hours = Math.floor(value / 3600);
|
||||
const minutes = Math.floor((value % 3600) / 60);
|
||||
const hours = Math.floor(value);
|
||||
const minutes = Math.floor((value % 1) * 60);
|
||||
return `${label}: ${hours}h ${minutes}m`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user