Skip to content

feat: add kcal as a weight unit for cardio workout logging#2365

Open
vic-aibuilder wants to merge 1 commit into
wger-project:masterfrom
vic-aibuilder:feat/kcal-cardio-unit
Open

feat: add kcal as a weight unit for cardio workout logging#2365
vic-aibuilder wants to merge 1 commit into
wger-project:masterfrom
vic-aibuilder:feat/kcal-cardio-unit

Conversation

@vic-aibuilder

@vic-aibuilder vic-aibuilder commented May 31, 2026

Copy link
Copy Markdown

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:

  • Added WEIGHT_UNIT_KCAL = 7 constant to wger/manager/consts.py
  • Added data migration 0023_add_kcal_weight_unit.py to seed the kcal WeightUnit row (pk=7)

UI compatibility

The React frontend (wger-project/react) fetches weight units dynamically from the API via getRoutineWeightUnits() in src/components/Routines/api/workoutUnits.ts, which calls the setting-weightunit endpoint. No frontend changes are required — kcal will appear automatically in the unit selector once this migration runs.

Out of scope (follow-up)

  • Automatic calorie calculation from exercise type — as discussed in the issue, this is a separate, larger feature
  • Flutter UI (tracked in wger-project/flutter)

Closes #2019

🤖 Generated with Claude Code

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>
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.

Add “Calories burned” as an acceptable measure unit for cardio (UI + API)

1 participant