feat: rebuild math life around marks and directed endings

This commit is contained in:
2026-08-10 01:06:06 +08:00
parent b8916180a9
commit aafaf1b77a
14 changed files with 838 additions and 29 deletions
@@ -16,6 +16,7 @@ from math_life.models import (
StoryVersion,
)
from math_life.services import validate_story_content
from math_life.story_v12 import V12_IDENTITY_SCORES, build_v12_story
DISCIPLINE_ICONS = {
"人工智能": "🤖",
@@ -157,12 +158,15 @@ class Command(BaseCommand):
"clan": result["clan_name"],
"mathematician": result["mathematician"],
"description": result["description"],
"initial_abilities": result.get("stats5", {}),
"initial_abilities": V12_IDENTITY_SCORES.get(
code,
result.get("stats5", {}),
),
"portrait": result.get("portrait", ""),
},
)
story_document = load_json(story_path)
story_document = build_v12_story(load_json(story_path))
errors = validate_story_content(story_document)
if errors:
raise CommandError("; ".join(errors))
@@ -176,9 +180,12 @@ class Command(BaseCommand):
"is_visible": True,
},
)
StoryVersion.objects.filter(story=flagship).exclude(version=2).update(
is_published=False
)
StoryVersion.objects.update_or_create(
story=flagship,
version=1,
version=2,
defaults={
"content": story_document,
"is_published": True,