feat: add AST_CHECK_FAILED status, is_accepted helper, ast_rules field
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
18
problem/migrations/0010_problem_ast_rules.py
Normal file
18
problem/migrations/0010_problem_ast_rules.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 6.0.4 on 2026-05-26 02:36
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('problem', '0009_alter_problem_accepted_number_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='problem',
|
||||
name='ast_rules',
|
||||
field=models.JSONField(blank=True, default=None, null=True),
|
||||
),
|
||||
]
|
||||
@@ -83,6 +83,9 @@ class Problem(models.Model):
|
||||
flowchart_hint = models.TextField(null=True, blank=True)
|
||||
show_flowchart = models.BooleanField(default=False, db_default=False)
|
||||
|
||||
# AST 代码结构检查规则
|
||||
ast_rules = models.JSONField(null=True, blank=True, default=None)
|
||||
|
||||
class Meta:
|
||||
db_table = "problem"
|
||||
constraints = [
|
||||
|
||||
@@ -86,6 +86,9 @@ class CreateOrEditProblemSerializer(serializers.Serializer):
|
||||
|
||||
flowchart_hint = serializers.CharField(allow_blank=True, allow_null=True, required=False)
|
||||
|
||||
# AST 规则
|
||||
ast_rules = serializers.JSONField(required=False, allow_null=True, default=None)
|
||||
|
||||
|
||||
class CreateProblemSerializer(CreateOrEditProblemSerializer):
|
||||
pass
|
||||
@@ -146,6 +149,7 @@ class ProblemSerializer(BaseProblemSerializer):
|
||||
"visible",
|
||||
"is_public",
|
||||
"answers",
|
||||
"ast_rules",
|
||||
)
|
||||
|
||||
def get_mermaid_code(self, obj):
|
||||
@@ -196,6 +200,7 @@ class ProblemSafeSerializer(BaseProblemSerializer):
|
||||
"accepted_number",
|
||||
"statistic_info",
|
||||
"answers",
|
||||
"ast_rules",
|
||||
)
|
||||
|
||||
def get_mermaid_code(self, obj):
|
||||
|
||||
Reference in New Issue
Block a user