feat: 每门课用独立会话学习,间隔改动即时生效,间隔为 0 时不显示倒计时

This commit is contained in:
2026-11-17 17:06:19 +08:00
parent e98cc13061
commit 42b29fb4d6
6 changed files with 424 additions and 53 deletions
+3 -3
View File
@@ -338,6 +338,7 @@ def set_study_settings(
if monthly_target is not None:
if not isinstance(monthly_target, int) or isinstance(monthly_target, bool) or not 0 <= monthly_target <= 9999:
raise HTTPException(status_code=400, detail="每月学时目标须为 0 到 9999 的整数")
workers_before = {account.employee_id: account.course_workers for account in accounts}
try:
for account in accounts:
if monthly_target is not None:
@@ -357,10 +358,9 @@ def set_study_settings(
from euniv.autostudy import restart_work, sync_work
for account in accounts:
if scheme is not None:
if scheme is not None or account.course_workers != workers_before[account.employee_id]:
restart_work(account.employee_id)
else:
sync_work(account.employee_id)
sync_work(account.employee_id)
return {"ok": True, "count": len(accounts)}