Skip to content

Add endpoint to retrieve the currently active routine (fixes #2361) - #2427

Open
soriadg wants to merge 1 commit into
wger-project:masterfrom
soriadg:fix/routine-active-detection
Open

Add endpoint to retrieve the currently active routine (fixes #2361)#2427
soriadg wants to merge 1 commit into
wger-project:masterfrom
soriadg:fix/routine-active-detection

Conversation

@soriadg

@soriadg soriadg commented Jul 11, 2026

Copy link
Copy Markdown

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 includes
    today (same QuerySet+Manager pattern as WorkoutLog).
  • GET /api/v2/routine/current/: returns the active routine (templates
    excluded). 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

  • Tests for the changes have been added (for bug fixes / features)
  • Code has been formatted to avoid unnecessary diffs (ruff format && isort .)
  • If the feature is big enough or if there are manual steps needed (deployment changes etc.), write a small writeup in CHANGELOG.md

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

Client displays the latest created routine in stead of the active one

1 participant