test#1
Closed
richardebeling wants to merge 13 commits intorichardebeling:mainfrom
Closed
Conversation
keep the textarea based question form
otherwise, we need to reset the counters after the migration
There was a problem hiding this comment.
Pull request overview
This PR performs a significant database schema refactoring to enable Question reuse across multiple Questionnaires. Previously, Questions had a direct ForeignKey relationship to a single Questionnaire. Now, Questions are related to Questionnaires through a many-to-many relationship implemented via a new QuestionAssignment model. This allows the same Question to be used in multiple Questionnaires while maintaining separate ordering and assignment metadata per questionnaire.
Changes:
- Introduced QuestionAssignment model as a through table for Question-Questionnaire many-to-many relationship
- Updated Answer models (TextAnswer, RatingAnswerCounter) to reference QuestionAssignment instead of Question directly
- Modified all forms, views, templates, and tests to work with the new structure
- Added two-step Django migrations to transition from the old to new schema
- Updated prefetch_related queries throughout the codebase for the new relationship structure
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| evap/evaluation/models.py | Added QuestionAssignment model, converted Question to use many-to-many relationship, updated Answer models to reference assignment |
| evap/evaluation/migrations/0160_*.py | Forward migration creating QuestionAssignment and deduplicating questions |
| evap/evaluation/migrations/0161_*.py | Completes migration by removing old Question model |
| evap/student/views.py | Updated vote view to iterate over question_assignments instead of questions |
| evap/staff/views.py | Updated questionnaire management views to use QuestionAssignmentForm |
| evap/staff/forms.py | Added QuestionAssignmentForm with nested QuestionForm, implemented copy-on-write for shared questions |
| evap/staff/templates/staff_questionnaire_form.html | Updated template to render nested question_form fields |
| evap/results/tools.py | Updated result calculation to work with assignments |
| evap/student/tests/test_views.py | Updated tests to use QuestionAssignment instead of Question |
| evap/staff/tests/test_views.py | Updated tests to create QuestionAssignments, added tests for question editing behavior |
| evap/staff/tests/test_forms.py | Updated form tests to use QuestionAssignment |
| evap/results/tests/*.py | Updated all result tests to use QuestionAssignment |
| evap/evaluation/tests/*.py | Updated model and command tests |
| evap/evaluation/management/commands/anonymize.py | Updated to work with assignments |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cba9062 to
f4016c3
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.
No description provided.