diff --git a/backend/app/routers/teach.py b/backend/app/routers/teach.py index d089b4c..d5265f3 100644 --- a/backend/app/routers/teach.py +++ b/backend/app/routers/teach.py @@ -8,10 +8,12 @@ from sqlalchemy.orm import Session from app.database import get_db from app.models.question import Question from app.models.ai_model_config import AIModelConfig +from app.models.attempt import QuizAttempt from app.models.user import User from app.utils.quiz_access import require_question_access +from app.services import site_settings from app.services.quiz_builder import bank_question_predicate -from app.utils.auth import get_current_user, check_rate_limit +from app.utils.auth import check_rate_limit, get_current_user, require_moderator router = APIRouter() @@ -131,6 +133,84 @@ def list_teach_models( return [{"id": m.id, "name": m.name, "model_id": m.model_id, "is_default": m.is_default} for m in models] +@router.get("/policy") +def tutor_policy(current_user: User = Depends(get_current_user)): + """Whether the tutor may be opened during a session. + + Asked before the quiz offers it, so a switch an administrator has thrown + reads as "not there" rather than as a button that fails when pressed. + Study mode is a separate rule the interface already applies and the server + enforces regardless of this answer. + """ + return {"in_quiz": site_settings.get_flag("tutor_in_quiz")} + + +@router.get("/prompt") +def show_prompt( + db: Session = Depends(get_db), + current_user: User = Depends(require_moderator), +): + """What the tutor is actually told, for anyone who maintains questions. + + An educator answering "why did the tutor say that?" should be able to read + the instructions rather than infer them, and the answer matters: the tutor + is handed the correct answer and the explanation, and is told it may + reveal them. That is the reason it is never offered during a running exam. + + Rendered against a stand-in question so the shape is visible without + naming any real one. + """ + example = Question( + id=0, + question_text="", + options=["