feat: add kcal as a weight unit for cardio workout logging#2365
Open
vic-aibuilder wants to merge 1 commit into
Open
feat: add kcal as a weight unit for cardio workout logging#2365vic-aibuilder wants to merge 1 commit into
vic-aibuilder wants to merge 1 commit into
Conversation
Adds kcal (kilocalorie) as a selectable weight unit in the workout logger, allowing users to log calories burned during cardio sessions alongside existing units like kg, lb, and km/h. - Added WEIGHT_UNIT_KCAL = 7 constant to manager/consts.py - Added data migration to seed the kcal WeightUnit row (pk=7) The existing WeightUnit FK on WorkoutLog and the RoutineWeightUnitViewSet (which queries WeightUnit.objects.all()) automatically expose the new unit via the API with no additional changes required. Closes wger-project#2019 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Adds
kcal(kilocalorie) as a selectable weight unit for workout log entries, allowing users to record calories burned during cardio sessions alongside existing units like kg, lb, and km/h.This implements the minimal backend change requested in #2019:
WEIGHT_UNIT_KCAL = 7constant towger/manager/consts.py0023_add_kcal_weight_unit.pyto seed thekcalWeightUnit row (pk=7)UI compatibility
The React frontend (
wger-project/react) fetches weight units dynamically from the API viagetRoutineWeightUnits()insrc/components/Routines/api/workoutUnits.ts, which calls thesetting-weightunitendpoint. No frontend changes are required — kcal will appear automatically in the unit selector once this migration runs.Out of scope (follow-up)
Closes #2019
🤖 Generated with Claude Code