Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api/exercise_sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/api/reading_sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/words/SessionHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down