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
+4 -1
View File
@@ -463,14 +463,17 @@ def put_study_bundle(body: StudyBundleBody, request: Request, db: Session = Depe
account = db.get(Account, _signed_in(request, db))
if account is None:
raise HTTPException(status_code=401, detail="未登录")
workers_before = account.course_workers
try:
_apply_study_bundle(account, body)
except HTTPException:
db.rollback()
raise
db.commit()
from euniv.autostudy import sync_work
from euniv.autostudy import restart_work, sync_work
if account.course_workers != workers_before:
restart_work(account.employee_id)
sync_work(account.employee_id)
payload = view_of(account)
payload["monthly_target"] = account.monthly_target