Fix: Refactor WorkoutSession to support overnight workouts (#2379) - #2422
Open
deepu4402020 wants to merge 18 commits into
Open
Fix: Refactor WorkoutSession to support overnight workouts (#2379)#2422deepu4402020 wants to merge 18 commits into
deepu4402020 wants to merge 18 commits into
Conversation
added 3 commits
July 7, 2026 00:36
- Replaced date, time_start, and time_end fields with datetime_start and datetime_end - Updated logging logic to map workouts crossing midnight correctly - Adjusted statistics and trophies calculations to use local timezones - Added data migration to preserve legacy workout dates - Fixed test suites to support multi-day sessions
Author
|
Hi @rolandgeider , Just following up on this PR whenever you have time. Could you please let me know if there are any changes needed or if there's anything blocking the review? I'd be happy to update it. Thanks! |
Member
|
Hey @deepu4402020 , sorry for the late reply. I'm just finishing up the current release and will be looking into merging this |
…n-datetime # Conflicts: # wger/core/tests/test_user.py # wger/gym/helpers.py # wger/manager/tests/test_workout_session.py
A log can be pinned to a session of another day through the API. Without the filter the data migration would move such a session to the day of its logs, silently shifting streaks and date-based trophies
rolandgeider
added a commit
that referenced
this pull request
Aug 13, 2026
…n testing # Conflicts: # CHANGELOG.md # settings/main.py # wger/manager/models/log.py
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.
Proposed Changes
As discussed in the issue with @rolandgeider and @DunklerPhoenix, this PR implements the proposed backend refactor for Workout Sessions:
date,time_start, andtime_endfields inWorkoutSessionwithdatetime_startanddatetime_endto fully support multi-day and overnight workouts natively.unique_togetherconstraint to support multiple discrete sessions/workouts per day (e.g., morning cardio, evening gym).MAX_SESSION_LENGTH_HOURS(set to 12h, taking the middle ground for long activities like hiking).WorkoutLoglogic to follow the exact session-matching priority order outlined by the maintainers.managerandtrophiestest suites to support the new multi-day session data structures.Related Issue(s)
Fixes #2379
Please check that the PR fulfills these requirements
ruff format && isort .)changes etc.), write a small writeup in
CHANGELOG.md