Fix: send session duration in seconds instead of converting to ms (issue #107)#997
Open
mircealungu wants to merge 1 commit intomasterfrom
Open
Fix: send session duration in seconds instead of converting to ms (issue #107)#997mircealungu wants to merge 1 commit intomasterfrom
mircealungu wants to merge 1 commit intomasterfrom
Conversation
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).
✅ Deploy Preview for voluble-nougat-015dd1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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* 1000inreadingSessionUpdateandreadingSessionEnd; add comment "the API expects seconds"src/api/exercise_sessions.js: same for exercise session update/endsrc/words/SessionHistory.js: updateformatDurationShort(ms)→formatDurationShort(seconds)— thesession_historyAPI now returns seconds for all session types (reading, exercise, browsing, listening), so the summary component displays correct timesTo discuss this fix, find this session at https://claude.ai/code