Skip to content

Fix: send session duration in seconds instead of converting to ms (issue #107)#997

Open
mircealungu wants to merge 1 commit intomasterfrom
auto-fix/issue-107
Open

Fix: send session duration in seconds instead of converting to ms (issue #107)#997
mircealungu wants to merge 1 commit intomasterfrom
auto-fix/issue-107

Conversation

@mircealungu
Copy link
Copy Markdown
Member

Summary

Part of zeeguu/api#107

The frontend timer (useSession.js) already counts in seconds. The API functions for reading and exercise sessions were unnecessarily multiplying by 1000 before sending, and the API was storing/returning milliseconds — requiring division by 1000 on display.

This PR removes that round-trip. Requires the corresponding API change in zeeguu/api#auto-fix/issue-107.

Changes (the core fix)

  • src/api/reading_sessions.js: remove * 1000 in readingSessionUpdate and readingSessionEnd; add comment "the API expects seconds"
  • src/api/exercise_sessions.js: same for exercise session update/end
  • src/words/SessionHistory.js: update formatDurationShort(ms)formatDurationShort(seconds) — the session_history API now returns seconds for all session types (reading, exercise, browsing, listening), so the summary component displays correct times

To discuss this fix, find this session at https://claude.ai/code

Part of zeeguu/api#107

The frontend timer already counts in seconds. Remove the unnecessary
* 1000 conversion when sending duration to the API endpoints
(reading_session_update/end, exercise_session_update/end).

Also update formatDurationShort in SessionHistory to treat duration
as seconds (consistent with the updated API response).
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 30, 2026

Deploy Preview for voluble-nougat-015dd1 ready!

Name Link
🔨 Latest commit 46b20ce
🔍 Latest deploy log https://app.netlify.com/projects/voluble-nougat-015dd1/deploys/69ca4ee530ff220008f352f8
😎 Deploy Preview https://deploy-preview-997--voluble-nougat-015dd1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants