Skip to content

Conversation

@rolandgeider
Copy link
Member

@rolandgeider rolandgeider commented Sep 28, 2025

Proposed Changes

This PR adds a new endpoint that performs some much needed sanity checks when user's submit exercises and can be updated in the future:

  • create the exercise and all sub-objects (translations, aliases, etc) in a single transaction, which makes sure that no orphans or broken exercises are kept, e.g. exercises with no translations, etc
  • Check that the description and comments are actually in the correct language, there are currently a lot of submissions where the base translation is eg. in Spanish, instead of English. While this won't happen in the future, the ones currently in the DB will have to be fixed by hand

Related Issue(s)

Frontend: wger-project/react#1126
Flutter: wger-project/flutter#929

This endpoint allows us to generate an exercise with all its sub-objects in one go, which is the correct way. Previously when the user was submitting a new exercise and something went wrong we would leave the database in an inconsistent state.
This can be used independently of the other validations for comments or translations, e.g. to check individual fields before saving to the db.
@rolandgeider rolandgeider merged commit 5f6f8ef into master Sep 28, 2025
6 checks passed
@rolandgeider rolandgeider deleted the feature/exercise-submission branch September 28, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants