Refactor rest time storage from seconds to human-readable strings - #17
Merged
Conversation
Store rest as a raw user-entered string instead of parsed seconds. Time parsing is removed from the editor and deferred to view-time. DB migration converts legacy restSeconds numbers to readable strings. https://claude.ai/code/session_01Rz6TMvT8FwbYhcfFEWaDmU
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
This PR refactors how rest times are stored in workout groups, changing from numeric seconds (
restSeconds: number) to human-readable strings (rest: string). This improves data clarity and eliminates the need for parsing/formatting logic in the UI layer.Key Changes
Type definition update: Changed
MovementGroup.restSeconds?: numbertoMovementGroup.rest?: stringinworkout-types.tsUI simplification: Removed
parseRestSeconds()andformatRestSeconds()functions fromWorkoutEditor.tsxand simplified the rest input handling to store/display raw string valuesMigration logic: Added
migrateRest()andmigrateRestSeconds()functions inplate-db.tsto handle backward compatibility with existing workouts that use the oldrestSecondsnumeric formatExport format update: Changed
ExportedGroup.restSeconds?: numbertoExportedGroup.rest?: stringinworkout-export.tsand updated packing/unpacking logic accordinglyViewer simplification: Removed
formatRest()function fromWorkoutViewer.tsxand updated display to use the rest string directlyImporter update: Updated
WorkoutImporter.tsxto work with the new rest string formatTest updates: Updated test expectations in
workout-export.test.tsto reflect the new string-based rest formatImplementation Details
restSecondsvalues to human-readable strings (e.g.,180→"3min",90→"1:30")https://claude.ai/code/session_01Rz6TMvT8FwbYhcfFEWaDmU