diff --git a/src/api/exercise_sessions.js b/src/api/exercise_sessions.js index 650c3e707..96c7c9d29 100644 --- a/src/api/exercise_sessions.js +++ b/src/api/exercise_sessions.js @@ -21,7 +21,7 @@ Zeeguu_API.prototype.exerciseSessionUpdate = function ( ) { let payload = { id: exerciseSessionId, - duration: currentDuration * 1000, // the API expects ms + duration: currentDuration, // the API expects seconds }; // Use beacon to prevent "Failed to fetch" errors when user navigates away @@ -34,7 +34,7 @@ Zeeguu_API.prototype.exerciseSessionEnd = function ( ) { let payload = { id: exerciseSessionId, - duration: totalTime * 1000, + duration: totalTime, // the API expects seconds }; // Use beacon to prevent "Failed to fetch" errors when user navigates away diff --git a/src/api/reading_sessions.js b/src/api/reading_sessions.js index 3b4280261..ed9899118 100644 --- a/src/api/reading_sessions.js +++ b/src/api/reading_sessions.js @@ -23,7 +23,7 @@ Zeeguu_API.prototype.readingSessionUpdate = function ( ) { let payload = { id: readingSessionId, - duration: currentDuration * 1000, //the API expects ms + duration: currentDuration, // the API expects seconds }; // Use beacon to prevent "Load failed" errors when user navigates away @@ -36,7 +36,7 @@ Zeeguu_API.prototype.readingSessionEnd = function ( ) { let payload = { id: readingSessionId, - duration: totalTime * 1000, + duration: totalTime, // the API expects seconds }; // Use beacon to prevent "Load failed" errors when user navigates away diff --git a/src/words/SessionHistory.js b/src/words/SessionHistory.js index 1fd798491..b5b57b0d9 100644 --- a/src/words/SessionHistory.js +++ b/src/words/SessionHistory.js @@ -388,9 +388,9 @@ function formatTime(isoString) { return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); } -function formatDurationShort(ms) { - if (!ms) return "0 min"; - const minutes = Math.round(ms / 60000); +function formatDurationShort(seconds) { + if (!seconds) return "0 min"; + const minutes = Math.round(seconds / 60); if (minutes < 60) return `${minutes} min`; const hours = Math.floor(minutes / 60); const remainingMins = minutes % 60;