Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing problem from contest does not remove contest_object from affected subs #2349

Open
kiritofeng opened this issue Sep 6, 2024 · 1 comment

Comments

@kiritofeng
Copy link
Member

Which in turn, corrupts the DB state.

@Ninjaclasher
Copy link
Member

Something like adding a signal

@receiver(post_delete, sender=ContestProblem)
def contest_problem_delete(sender, instance, **kwargs):
    Submission.objects.filter(contest_object=instance.contest, contest__isnull=True).update(contest_object=None)

should fix it, but I haven't tested it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants