Skip to content

Move the variation to a field in the exercise#1236

Merged
rolandgeider merged 2 commits intomasterfrom
feature/exercise-variations
Apr 14, 2026
Merged

Move the variation to a field in the exercise#1236
rolandgeider merged 2 commits intomasterfrom
feature/exercise-variations

Conversation

@rolandgeider
Copy link
Copy Markdown
Member

Proposed Changes

Implement changes from the backend and move the variation to a field in the exercise. Also, refactor the variation component and extract it so that the variations for existing exercises can be edited as well.

Also, refactor the variation component and extract it so that the variations
for existing exercises can be edited as well.
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 13, 2026

Coverage Status

coverage: 75.42% (-0.07%) from 75.488% — feature/exercise-variations into master

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the frontend to align with backend changes by replacing the old numeric variations/variationId linkage with a variation_group UUID field on exercises, and refactors the variation selection UI so variations can be edited for existing exercises.

Changes:

  • Replaced variationId/variations with variationGroup/variation_group across models, state, services, and test fixtures.
  • Extracted the variation picker into a reusable VariationSelect component and reused it in the exercise creation flow.
  • Added an edit UI (EditExerciseVariation) to modify an existing exercise’s variation group (including creating a new group and assigning two exercises to it).

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/tests/responseApi.ts Updates mocked API response/expected model to use variation_group/variationGroup.
src/tests/exerciseTestdata.ts Migrates exercise test fixtures from variationId to variationGroup.
src/tests/exercises/searchResponse.ts Updates search response fixtures to use variationGroup.
src/state/exerciseSubmissionState.tsx Renames submission state field to variationGroup (string UUID).
src/state/exerciseSubmissionReducer.ts Updates variation action to accept string UUID and stores into variationGroup.
src/services/variation.ts Removes now-obsolete variation creation service.
src/services/variation.test.ts Removes tests for the deleted variation service.
src/services/exercise.ts Updates variation query/filter and submission payload to use variation_group.
src/services/exercise.test.ts Adjusts mocked PATCH response field to variation_group.
src/components/Exercises/queries/variations.ts Removes obsolete mutation hook for creating variations.
src/components/Exercises/models/exercise.ts Renames model field to variationGroup and maps from variation_group.
src/components/Exercises/forms/VariationSelect.tsx New extracted UI component to search/group/select variations.
src/components/Exercises/forms/Variation.tsx New edit component to update an exercise’s variation_group.
src/components/Exercises/Detail/ExerciseDetails.tsx Updates variations query to key off variationGroup.
src/components/Exercises/Detail/ExerciseDetailEdit.tsx Adds a new “Variations” section for editing variation groups.
src/components/Exercises/Detail/ExerciseDetailEdit.test.tsx Import ordering adjustment related to the edit view test setup.
src/components/Exercises/Add/Step6Overview.tsx Submits variationGroup and updates display text to reference it.
src/components/Exercises/Add/Step6Overview.test.tsx Updates step 6 test state to use variationGroup.
src/components/Exercises/Add/Step2Variations.tsx Refactors step 2 to use the new VariationSelect component.
Comments suppressed due to low confidence (1)

src/state/exerciseSubmissionReducer.ts:51

  • setVariationId now takes a UUID string (variation group) but the action creator name and SET_VARIATION_ID constant still imply a numeric variation ID. Renaming these to setVariationGroup / SET_VARIATION_GROUP (and updating call sites) would reduce confusion and make the state shape self-describing.
export const setVariationId = (id: string | null): ExerciseSubmissionAction => {
    return { type: SetExerciseSubmissionState.SET_VARIATION_ID, payload: id };
};
export const setNewBaseVariationId = (id: number | null): ExerciseSubmissionAction => {
    return { type: SetExerciseSubmissionState.SET_NEW_VARIATION_BASE_ID, payload: id };

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rolandgeider rolandgeider moved this to In review in Release 2.5 Apr 13, 2026
@rolandgeider rolandgeider mentioned this pull request Apr 13, 2026
@rolandgeider rolandgeider merged commit c4bbb85 into master Apr 14, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Release 2.5 Apr 14, 2026
@rolandgeider rolandgeider deleted the feature/exercise-variations branch April 14, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants