Add questionnaire reset functionality#1532
Open
reppuli92 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds “questionnaire reset” behavior by tracking an exercise content-version hash (from mooc-grader) and the submission language, and reloading a fresh exercise page when the latest submission no longer matches the current exercise version or UI language.
Changes:
- Persist an
exercise_versionhash from the exercise service intoExercisePageandExerciseCache. - Stamp the current
exercise_versioninto new submissions’ metadata for later compatibility checks. - In the exercise view, compare the latest submission’s stored version/language against the current ones and reset (reload blank exercise) on mismatch.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| exercise/views.py | Adds reset logic when current exercise version/language differs from the latest submission’s metadata. |
| exercise/submission_models.py | Stamps exercise_version into submission metadata at submission creation time. |
| exercise/protocol/exercise_page.py | Introduces exercise_version field on ExercisePage. |
| exercise/protocol/aplus.py | Parses x-aplus-exercise-version from the remote page meta into ExercisePage. |
| exercise/cache/exercise.py | Stores exercise_version in the cached exercise page data and refreshes legacy cache entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Sorry for the confusion :) tried to make things look nice on my repo but ended up breaking things |
f8f12ef to
8c19aa6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
What?
Make questionnaire exercises reset and not show model answer when they are edited or when the course language is changed
Why?
This is done so that the correct version of a questionnaire is always shown to students
How?
A-plus checks an exercise version hash from mooc-grader (separate PR on mooc-grader) and compares it to the latest submission's hash. The page's language is compared as well to the submission's, and if either mismatch, the form is reset.
Fixes #494
Testing
Remember to add or update unit tests for new features and changes.
What type of test did you run?
I tested that the reset functionality works in the UI by editing aplus-manual and reloading a-plus while keeping old submission data cached. I also tested the language change.
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Programming style
Have you updated the README or other relevant documentation?
Is it Done?
Clean up your git commit history before submitting the pull request!