Rename problem data fields
This commit is contained in:
parent
acdf94a8c9
commit
5e72b472e6
8 changed files with 277 additions and 170 deletions
75
judge/migrations/0182_rename_customcpp.py
Normal file
75
judge/migrations/0182_rename_customcpp.py
Normal file
|
@ -0,0 +1,75 @@
|
|||
# Generated by Django 3.2.18 on 2024-03-19 04:28
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def migrate_checker(apps, schema_editor):
|
||||
ProblemData = apps.get_model("judge", "ProblemData")
|
||||
ProblemTestCase = apps.get_model("judge", "ProblemTestCase")
|
||||
|
||||
for p in ProblemData.objects.all():
|
||||
if p.checker == "customval":
|
||||
p.checker = "customcpp"
|
||||
p.save()
|
||||
|
||||
for p in ProblemTestCase.objects.all():
|
||||
if p.checker == "customval":
|
||||
p.checker = "customcpp"
|
||||
p.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("judge", "0181_remove_math_engine"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(migrate_checker, migrations.RunPython.noop, atomic=True),
|
||||
migrations.AlterField(
|
||||
model_name="problemdata",
|
||||
name="checker",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
("standard", "Standard"),
|
||||
("floats", "Floats"),
|
||||
("floatsabs", "Floats (absolute)"),
|
||||
("floatsrel", "Floats (relative)"),
|
||||
("rstripped", "Non-trailing spaces"),
|
||||
("sorted", "Unordered"),
|
||||
("identical", "Byte identical"),
|
||||
("linecount", "Line-by-line"),
|
||||
("custom", "Custom checker (PY)"),
|
||||
("customcpp", "Custom checker (CPP)"),
|
||||
("interact", "Interactive"),
|
||||
("testlib", "Testlib"),
|
||||
],
|
||||
max_length=10,
|
||||
verbose_name="checker",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="problemtestcase",
|
||||
name="checker",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
("standard", "Standard"),
|
||||
("floats", "Floats"),
|
||||
("floatsabs", "Floats (absolute)"),
|
||||
("floatsrel", "Floats (relative)"),
|
||||
("rstripped", "Non-trailing spaces"),
|
||||
("sorted", "Unordered"),
|
||||
("identical", "Byte identical"),
|
||||
("linecount", "Line-by-line"),
|
||||
("custom", "Custom checker (PY)"),
|
||||
("customcpp", "Custom checker (CPP)"),
|
||||
("interact", "Interactive"),
|
||||
("testlib", "Testlib"),
|
||||
],
|
||||
max_length=10,
|
||||
verbose_name="checker",
|
||||
),
|
||||
),
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue