Skip to content

Commit

Permalink
Remove contest_object from submissions whose problem is removed fro…
Browse files Browse the repository at this point in the history
…m contest; fixes #2349
  • Loading branch information
kiritofeng committed Dec 18, 2024
1 parent 743bf09 commit f30dce4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions judge/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from django.dispatch import receiver

from .caching import finished_submission
from .models import BlogPost, Comment, Contest, ContestSubmission, EFFECTIVE_MATH_ENGINES, Judge, Language, License, \
MiscConfig, Organization, Problem, Profile, Submission, WebAuthnCredential
from .models import BlogPost, Comment, Contest, ContestProblem, ContestSubmission, EFFECTIVE_MATH_ENGINES, Judge, \
Language, License, MiscConfig, Organization, Problem, Profile, Submission, WebAuthnCredential


def get_pdf_path(basename: str) -> Optional[str]:
Expand Down Expand Up @@ -79,6 +79,11 @@ def contest_update(sender, instance, **kwargs):
for engine in EFFECTIVE_MATH_ENGINES])


@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)


@receiver(post_save, sender=License)
def license_update(sender, instance, **kwargs):
cache.delete(make_template_fragment_key('license_html', (instance.id,)))
Expand Down

0 comments on commit f30dce4

Please sign in to comment.