31 lines
835 B
Python
31 lines
835 B
Python
#!/usr/bin/env python3
|
|
"""Создать 5 тестовых профилей норм (lab_math_dairy_01 … 05) из data/seed/norms."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_ROOT = Path(__file__).resolve().parents[1]
|
|
if str(_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(_ROOT))
|
|
|
|
from app import create_app, db
|
|
from app.lab.commands.seed_math_test_profiles import seed_math_test_profiles
|
|
from config import Config
|
|
|
|
|
|
def main() -> int:
|
|
app = create_app(Config)
|
|
with app.app_context():
|
|
stats = seed_math_test_profiles()
|
|
print(f"created={stats.created} updated={stats.updated}")
|
|
for err in stats.errors:
|
|
print("ERROR:", err)
|
|
db.session.remove()
|
|
return 0 if not stats.errors else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|