Skip to content

Add heart rate and duration fields to log model - #2128

Closed
elias170105 wants to merge 1 commit into
wger-project:masterfrom
elias170105:patch-1
Closed

elias170105 wants to merge 1 commit into
wger-project:masterfrom
elias170105:patch-1

Conversation

@elias170105

@elias170105 elias170105 commented Nov 30, 2025 •

Copy link
Copy Markdown
Contributor

Proposed Changes

  • Added bpm_max (PositiveInteger), bpm_avg (PositiveInteger), and duration (DurationField) to the WorkoutLog model to allow tracking of cardio exercises.
  • Updated WorkoutLogSerializer in serializers.py to expose these fields via the API.
  • Added database migration files.

These fields are optional (blank=True, null=True), so they won't enforce data entry for strength training logs.

Note: I could not locate the WorkoutLogForm definition (it seems missing from wger/manager/forms.py in the current file structure). Therefore, this PR currently only enables these fields in the Backend and API, but not yet in the classic Web UI.

Related Issue(s)

(If you have an issue number, replace this line with: Closes #YOUR_ISSUE_NUMBER. If not, you can delete this section.)

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Code has been formatted to avoid unnecessary diffs (ruff format && isort .)

Other questions

  • Do users need to run some commands in their local instances due to this PR
    (e.g. database migration, deployment changes)?

Yes, database migrations are required:
python manage.py migrate

Added fields for maximum and average heart rate, and duration, for the Cardiotrecking
@elias170105
elias170105 marked this pull request as ready for review November 30, 2025 21:18
@barkerd427

Copy link
Copy Markdown

@elias170105 thanks for this. One idea on bpm_avg/bpm_max: wger could compute those per session from the heart_rate measurements between datetime_start and datetime_end instead of storing them on the log. That way there's one source of truth, and anything already syncing heart rate gets the summary for free. duration makes sense either way.

Happy to help with tests or a draft if that direction works for you and the maintainers. Related: #2557 adds a device source for wearable data.

@rolandgeider

rolandgeider commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

@barkerd427 is right, it would be easier (and cleaner) to log the heart rate and then show those values in the workout overview. This would probably be interesting, regardless of whether this was a cardio exercise/workout.

What we could do however, is add heart rate to the list of units, so that you could define an exercise has having a goal of "x minutes, y hear rate".

I'm afraid I'll have to close the PR

Edit: I've opened a new issue in #2563

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.

3 participants