Skip to content

[HnR-Autograder:2] Per-phase auto-grading config model - #7440

Draft
Elimpizza wants to merge 1 commit into
mainfrom
feat/hnr-autograder-model
Draft

[HnR-Autograder:2] Per-phase auto-grading config model#7440
Elimpizza wants to merge 1 commit into
mainfrom
feat/hnr-autograder-model

Conversation

@Elimpizza

Copy link
Copy Markdown
Contributor

This pull request introduces a chainable configuration model for auto-grading phases in assignments. The main change is the addition of a self-referential foreign key in the AutoGradingConfig model, allowing configurations to be linked in a sequence (or "chain"). Comprehensive unit tests are also added to ensure the correctness of this new structure and its constraints. Additionally, minor corrections are made to the test factories.

AutoGradingConfig model enhancements:

  • Added a previous_config_id field to AutoGradingConfig, which is a self-referential foreign key, allowing each config to point to the previous one in the chain. This field is unique (except for NULL), nullable, and uses a custom constraint name to avoid Postgres identifier length issues.
  • Added a previous_config relationship to the model for convenient ORM access to the previous config object.

Testing improvements:

  • Added a new TestAutoGradingConfig test class that verifies:
    • Configs can form a chain by linking to a previous config.
    • The first config in a chain has no previous config.
    • Multiple configs can have previous_config_id as NULL (for different assignments).
    • No config can be the previous config for more than one other config (enforced by uniqueness).
    • Deleting a config cascades and deletes the rest of the chain.
  • Imported IntegrityError for testing uniqueness constraint violations.

Test factory corrections:

  • Fixed the assignment of activity_calculation and grading_type in the AutoGradingConfig factory to use the correct enum types.

@Elimpizza
Elimpizza marked this pull request as ready for review August 24, 2026 14:08
@Elimpizza
Elimpizza marked this pull request as draft August 24, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants