direct no load history when no history
This commit is contained in:
@@ -6,6 +6,7 @@ from ..services.backboard_service import realtime_response
|
|||||||
from ..extension_ase.ase_client.manager import ChatManager
|
from ..extension_ase.ase_client.manager import ChatManager
|
||||||
import subprocess
|
import subprocess
|
||||||
from ..auth.decorators import require_role
|
from ..auth.decorators import require_role
|
||||||
|
from ..services.course_service import load_learning_progress
|
||||||
|
|
||||||
bp = Blueprint("vscode", __name__)
|
bp = Blueprint("vscode", __name__)
|
||||||
|
|
||||||
@@ -149,7 +150,18 @@ def desktop(user_uuid, course_id, chapter_name, lesson_name):
|
|||||||
def desktop_nouser(course_id, chapter_name, lesson_name):
|
def desktop_nouser(course_id, chapter_name, lesson_name):
|
||||||
if "user_uuid" not in session:
|
if "user_uuid" not in session:
|
||||||
return redirect(url_for("auth.login")) # 如果你有 auth 蓝图
|
return redirect(url_for("auth.login")) # 如果你有 auth 蓝图
|
||||||
|
|
||||||
user_uuid = session["user_uuid"]
|
user_uuid = session["user_uuid"]
|
||||||
|
uuid2username = current_app.extensions["uuid2username"]
|
||||||
|
user_id = uuid2username[user_uuid]
|
||||||
|
|
||||||
|
# 检查是否有学习记录
|
||||||
|
progress_result = load_learning_progress(user_id, course_id, chapter_name, lesson_name)
|
||||||
|
|
||||||
|
if not progress_result["exists"]:
|
||||||
|
# 没有学习记录,直接跳转到学习页面,不显示确认加载历史的页面
|
||||||
|
return redirect(url_for("vscode.desktop", user_uuid=user_uuid, course_id=course_id, chapter_name=chapter_name, lesson_name=lesson_name, load_history="false"))
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"confirm_load_history.html",
|
"confirm_load_history.html",
|
||||||
user_uuid=user_uuid,
|
user_uuid=user_uuid,
|
||||||
|
|||||||
Reference in New Issue
Block a user