feat(workouts): add active workout abandon flow for execution exit - #62
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis pull request introduces an "abandon workout" feature that resets an active workout to its assigned state. The implementation adds a new backend API endpoint Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🚀 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}/abandoncommand to the existing workouts execution stack, wires it through the repository andWorkoutExecutionCubit, 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 analyzeflutter test test/features/workouts