Update participation when editing contest from UI

This commit is contained in:
cuom1999 2022-11-04 16:56:26 -05:00
parent c86e34fba1
commit ac2fd3dfe0
2 changed files with 10 additions and 1 deletions

View file

@ -113,7 +113,7 @@ class ICPCContestFormat(DefaultContestFormat):
if format_data:
penalty = (
format_html(
'<small style="color:red"> ({penalty})</small>',
'<small style="color:red"> +{penalty}</small>',
penalty=floatformat(format_data["penalty"]),
)
if format_data["penalty"]

View file

@ -7,6 +7,7 @@ from django.contrib.auth.models import User
from django.contrib.auth.forms import AuthenticationForm
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.core.validators import RegexValidator
from django.db import transaction
from django.db.models import Q
from django.forms import (
CharField,
@ -45,6 +46,7 @@ from judge.widgets import (
Select2MultipleWidget,
DateTimePickerWidget,
)
from judge.tasks import rescore_contest
def fix_unicode(string, unsafe=tuple("\u202a\u202b\u202d\u202e")):
@ -249,6 +251,13 @@ class EditOrganizationContestForm(ModelForm):
self.fields[field].widget.get_url() + "?org_id=1"
)
def save(self, commit=True):
res = super(EditOrganizationContestForm, self).save(commit=False)
if commit:
res.save()
transaction.on_commit(rescore_contest.s(res.key).delay)
return res
class Meta:
model = Contest
fields = (