Files
secondary-school-grade-archive/backend/app/services/school_level.py
T
dekun e329d3398a Initial commit: secondary school grade archive system.
Add FastAPI/React app with Docker deployment, Ubuntu one-click install, and docs for junior/senior high score tracking and mistake bank.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 11:18:58 +08:00

18 lines
488 B
Python

from app.models.user import SchoolLevel
SCHOOL_LEVEL_LABELS: dict[SchoolLevel, str] = {
SchoolLevel.junior_high: "初中",
SchoolLevel.senior_high: "高中",
}
def school_level_label(level: SchoolLevel | str | None) -> str:
if level is None:
return "初中"
if isinstance(level, str):
try:
level = SchoolLevel(level)
except ValueError:
return "初中"
return SCHOOL_LEVEL_LABELS.get(level, "初中")