Skip to content

feat: Add contest problem statement override feature#516

Open
whlongg wants to merge 3 commits intoVNOI-Admin:masterfrom
whlongg:feat/contest-problem-override
Open

feat: Add contest problem statement override feature#516
whlongg wants to merge 3 commits intoVNOI-Admin:masterfrom
whlongg:feat/contest-problem-override

Conversation

@whlongg
Copy link
Contributor

@whlongg whlongg commented Jan 10, 2026

Description

This PR implements the contest problem statement override feature, allowing contest organizers to customize problem names, descriptions, and PDF statements for specific contests without modifying the original problem data.

Type of change: New feature

What

This PR adds the ability to override problem statements (name, description, PDF URL) on a per-contest basis. When a problem is added to a contest, organizers can now:

  • Override the problem name to prevent recognition
  • Override the problem description with contest-specific content
  • Override the PDF statement URL with a custom document

The original problem data remains unchanged, and overrides only apply within the specific contest context.

Why

This feature addresses issue #493 where contest organizers need to modify problem statements to:

  • Prevent contestants from recognizing problems and finding existing solutions online
  • Customize problem content for specific contest themes or difficulty levels
  • Provide localized or simplified versions of problems

Without this feature, organizers had to either:

  1. Create duplicate problems (causing database bloat)
  2. Modify original problems (affecting other contests using the same problem)

Fixes #493

How Has This Been Tested?

Manual Testing:

  • Created test contest with problem overrides via Django admin
  • Verified overridden name displays in contest problem list
  • Verified overridden description displays in problem detail page
  • Verified overridden PDF URL is used when accessing problem statement
  • Verified original problem data remains unchanged
  • Verified fallback to original values when no override is set
  • Tested with browser at http://localhost:8000/contest/override_test/

Code Quality:

  • Ran flake8 on all modified Python files - no errors
  • Verified migration applies cleanly

Checklist

  • I have explained the purpose of this PR.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the README/documentation
  • Any dependent changes have been merged and published in downstream modules
  • Informed of breaking changes, testing and migrations (if applicable).
  • Attached screenshots (if applicable).

Screenshots:
image

image image image

By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.

- Add name_override, pdf_url_override, description_override fields to ContestProblem model
- Add effective_name, effective_pdf_url, effective_description properties
- Update admin interface to support override fields
- Update contest views to display overridden values
- Update templates to use effective values
- Add migration 0216_contest_problem_override_fields

Closes VNOI-Admin#493
@magnified103 magnified103 self-requested a review February 4, 2026 11:45
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.

Add option to override statement when adding to contest

2 participants