Skip to content

Allow deleting a workout session from the calendar - #1326

Merged
rolandgeider merged 2 commits into
wger-project:masterfrom
whoalin1:feat/delete-workout-session
Oct 23, 2026
Merged

rolandgeider merged 2 commits into
wger-project:masterfrom
whoalin1:feat/delete-workout-session

Conversation

@whoalin1

Copy link
Copy Markdown
Contributor

Proposed Changes

  • Add a delete button to each workout session in the calendar's entries panel. It opens the existing DeleteConfirmationModal before anything is deleted, and the dialog says that the sets logged in the session are deleted too (WorkoutLog.session is on_delete=CASCADE on the server).
  • New deleteSession() API call (DELETE /api/v2/workoutsession/<id>/) and useDeleteSessionQuery(). On success it invalidates the session reads, routine log data/stats and exercise analytics.
  • CalendarComponent now passes the selected day's entries to Entries from the current query data (matched by date), instead of from the DayProps object stored when the day was clicked. Without this, a deleted session stayed in the panel, or the panel jumped back to today when the data refreshed. This replaces the effect that re-selected today whenever the data changed. The initial selection is still today.

Related Issue(s)

Closes wger-project/wger#2002. In that issue, deleting a session from the UI was confirmed as not possible yet and a PR was invited.

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)

Tests added:

  • session.test.ts: deleteSession sends a DELETE to /workoutsession/<id>/
  • Entries.test.tsx: delete runs only after confirming, and closing the dialog deletes nothing
  • CalendarComponent.test.tsx: after a delete the session disappears from the selected day and the selection stays on that day. This test fails without the CalendarComponent change.

What I ran locally (Node 24): LANG=de_de npx vitest run (180 files / 1178 tests pass), npx eslint on the changed files, and npx tsc --noEmit. I didn't test this manually against a running wger server.

AI assistance was used to write this change. I reviewed the diff and ran the checks above.

whoalin1 and others added 2 commits October 23, 2026 20:11
Storing the clicked DayProps may leave the entries panel on a stale copy
once the month changes. Keep only the date, derive the month and the
day's data from it, and move the selection along when changing months.
@rolandgeider
rolandgeider merged commit 1fe9372 into wger-project:master Oct 23, 2026
7 checks passed
@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 83.887% (+0.06%) from 83.83% — whoalin1:feat/delete-workout-session into wger-project:master

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.

unable to delete training log/session

3 participants