Skip to content

feat(workouts): add active workout abandon flow for execution exit - #62

Merged
CowboyGH merged 8 commits into
developfrom
feature/workout-abandon
Apr 4, 2026
Merged

CowboyGH merged 8 commits into
developfrom
feature/workout-abandon

Conversation

@CowboyGH

@CowboyGH CowboyGH commented Apr 4, 2026 •

Copy link
Copy Markdown
Owner

🚀 Summary

Implemented the active workout abandon flow for authenticated workout execution, so closing an in-progress workout no longer marks it as completed.

The branch adds the new /api/workouts/{userWorkout}/abandon command to the existing workouts execution stack, wires it through the repository and WorkoutExecutionCubit, and updates the execution UI so both the close button and warmup back action reset the started workout back to assigned. The existing completion path after the last exercise remains unchanged, while the exit dialog, loading states, and navigation now reflect the real abandon semantics and return the user to workout details without showing the completion modal.

🧪 Verification

  • flutter analyze
  • flutter test test/features/workouts

@CowboyGH CowboyGH self-assigned this Apr 4, 2026
@CowboyGH CowboyGH added area: network API, requests, and data parsing area: ui/ux Widgets, layout, animations, or design area: logic State management and business logic type: feature New feature or request labels Apr 4, 2026
@coderabbitai

coderabbitai Bot commented Apr 4, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b636133b-d0a5-4863-9b11-865601b1ef09

📥 Commits

Reviewing files that changed from the base of the PR and between 7cc8be4 and 2bcf23c.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • lib/features/workouts/data/remote/workouts_api_client.dart
  • lib/features/workouts/execution/data/repositories/workout_execution_repository_impl.dart
  • lib/features/workouts/execution/domain/repositories/workout_execution_repository.dart
  • lib/features/workouts/execution/presentation/cubits/workout_execution_cubit.dart
  • lib/features/workouts/execution/presentation/cubits/workout_execution_state.dart
  • lib/features/workouts/execution/presentation/pages/workout_execution_page.dart
  • test/features/workouts/execution/data/repositories/workout_execution_repository_impl_test.dart
  • test/features/workouts/execution/presentation/cubits/workout_execution_cubit_test.dart

📝 Walkthrough

Walkthrough

This pull request introduces an "abandon workout" feature that resets an active workout to its assigned state. The implementation adds a new backend API endpoint abandonWorkout and extends the workout execution repository and cubit to support this operation. The UI workflow is updated to call the new abandon method instead of the previous exit warmup action when users close their workout. Error handling mirrors existing repository patterns. Tests are added for the repository method, cubit behavior, and state transitions.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant UI as Workout Page
    participant Cubit as Workout Cubit
    participant Repo as Repository
    participant API as API Client
    participant Backend as Backend

    User->>UI: Tap back/close button
    UI->>Cubit: abandonWorkout()
    Cubit->>Cubit: Emit state with isAbandoning: true
    Cubit->>Repo: abandonWorkout(userWorkoutId)
    Repo->>API: POST /workouts/{id}/abandon
    API->>Backend: Abandon request
    Backend-->>API: Success (200)
    API-->>Repo: void
    Repo-->>Cubit: Result.success(null)
    Cubit->>Cubit: Emit state with isAbandoning: false<br/>shouldPopToDetails: true
    Cubit-->>UI: State updated
    UI->>UI: Navigate back to details
    UI-->>User: Workout reset to assigned
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #49: Modifies the same workout execution flow layers (cubits, repository, API client, page, and tests) with related state management and control flow changes
  • PR #47: Extends the WorkoutsApiClient interface with new endpoints, sharing the same API client file as this PR's abandonWorkout endpoint addition

Poem

🐰 A workout abandoned, not completed, no fret—
The warmup's back button now resets the set!
From active to assigned, with a hop and a bound,
The abandon command makes reset go 'round! 🎯

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding an abandon workflow for exiting active workouts during execution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/workout-abandon

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CowboyGH
CowboyGH merged commit a1151c4 into develop Apr 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: logic State management and business logic area: network API, requests, and data parsing area: ui/ux Widgets, layout, animations, or design type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant