- content.Subject + Unit.subject, /api/home?subject=, tutor grounded in the chosen book - 5 new books ingested; ~1150 hand-written questions, islands named by hand - node_split: islands over 7 lessons split into parts of <=6 (lesson ids and progress kept) - Lesson.figures hand-authored and visually checked for 653 lessons of the new books; gen_lesson_figures got --subject and survives network errors - seed files re-exported Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
from django.db import migrations
|
||
|
||
from content.node_split import split_long_nodes
|
||
|
||
|
||
def split(apps, schema_editor):
|
||
"""
|
||
جزیرههای بلندِ (بیش از ۷ درس) پایههای سوم تا دوازدهم را به جزیرههای حداکثر ۶ درسی میشکند (`content/node_split.py`).
|
||
روی دیتابیسِ خالی (تست، سرورِ تازه) هیچ کاری نمیکند؛ آنجا `seed_content` از فایلِ بازساختهشده میسازد.
|
||
"""
|
||
Unit = apps.get_model('content', 'Unit')
|
||
stats = split_long_nodes(
|
||
Node=apps.get_model('content', 'Node'),
|
||
Lesson=apps.get_model('content', 'Lesson'),
|
||
UserNodeCompletion=apps.get_model('content', 'UserNodeCompletion'),
|
||
NodeProgress=apps.get_model('content', 'NodeProgress'),
|
||
units=Unit.objects.filter(grade__number__in=range(3, 13)).order_by('id'),
|
||
)
|
||
if stats['nodes_split']:
|
||
print(f'\n split_long_nodes: {stats}')
|
||
|
||
|
||
class Migration(migrations.Migration):
|
||
dependencies = [('content', '0017_calculus_units')]
|
||
operations = [migrations.RunPython(split, migrations.RunPython.noop)]
|