e329d3398a
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>
18 lines
488 B
Python
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, "初中")
|