Add endpoint to retrieve the currently active routine (fixes #2361) - #2427
Open
soriadg wants to merge 1 commit into
Open
Add endpoint to retrieve the currently active routine (fixes #2361)#2427soriadg wants to merge 1 commit into
soriadg wants to merge 1 commit into
Conversation
…ject#2361) The client showed the most recently created routine on the front page instead of the one currently running, since Routine only supported ordering by -start/-created. Add Routine.objects.active() to find the routine whose date range includes today, plus a GET /api/v2/routine/current/ action that returns it (falling back to the most recent routine when none is active, excluding templates). Frontend/mobile need a follow-up PR to consume this endpoint.
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.
The dashboard (web and app) shows the most recently created routine, even if
it hasn't started yet or already ended. The backend had no way to ask for the
routine that is actually running today.
Proposed Changes
Routine.objects.active(): returns routines whose start/end range includestoday (same QuerySet+Manager pattern as
WorkoutLog).GET /api/v2/routine/current/: returns the active routine (templatesexcluded). Falls back to the most recent one if none is active, 404 if the
user has no routines.
Backend-only: clients need a follow-up to consume the new endpoint.
Related Issue(s)
Closes #2361
Please check that the PR fulfills these requirements
ruff format && isort .)CHANGELOG.md