feat: Question variations support in assignment groups#97
Draft
feat: Question variations support in assignment groups#97
Conversation
Agent-Logs-Url: https://github.com/blockpy-edu/blockpy-server/sessions/b7d080fe-c574-47f2-8aee-23d923d6f450 Co-authored-by: acbart <[email protected]>
…stinction) Agent-Logs-Url: https://github.com/blockpy-edu/blockpy-server/sessions/b7d080fe-c574-47f2-8aee-23d923d6f450 Co-authored-by: acbart <[email protected]>
Copilot
AI
changed the title
[WIP] Add question variations support in assignment groups
feat: Question variations support in assignment groups
Apr 26, 2026
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.
Assignment groups currently show every student the same set of assignments. This adds per-student variation support: a group can have a pool of assignments where each student is assigned only a subset (e.g., 2 of 4 possible questions).
Schema changes
AssignmentGroup.variation_count(int, default0) — when> 0, students complete this many variation groups instead of all assignmentsAssignmentGroupMembership.variation_group(nullable int) —NULL= required for everyone; positive integer = variation pool tagassignment_group_variationtable — records the specific(user, group, assignment)triples representing each student's assigned subsetModel logic
AssignmentGroup.get_assignments(user_id=None)is extended to filter by variation whenuser_idis supplied andvariation_count > 0:New helpers on
AssignmentGroup:get_variation_groups()— distinct variation pool numbers in useassign_variation_to_user(user_id, assignment_ids)— explicit per-student assignmentassign_random_variation(user_id)— randomly selectsvariation_countpools and assignsparse_assignment_loadincontrollers/helpers.pynow passesuser_idso students loading a group URL automatically see only their assigned subset.New API endpoints (
/assignment_group/)/edit_variation_settingsvariation_countand per-membershipvariation_grouptags/get_variations/assign_variation/assign_variations_randomMigration
Alembic migration
b1c2d3e4f5a6addsassignment_group.variation_count,assignment_group_membership.variation_group, and theassignment_group_variationtable.