feat: 增加公告栏并让用户自选学时判断
This commit is contained in:
@@ -62,10 +62,9 @@ def _iso_time(value: datetime | None) -> str | None:
|
||||
|
||||
|
||||
def list_users(db: Session) -> list[dict]:
|
||||
from admin.settings import hours_source_of
|
||||
from admin.settings import account_hours_source
|
||||
from euniv.autostudy import autostudy_status, work_running
|
||||
|
||||
source = hours_source_of()
|
||||
accounts = db.scalars(select(Account).order_by(Account.employee_id)).all()
|
||||
live_users = autostudy_status().get("users") or {}
|
||||
rows = []
|
||||
@@ -85,7 +84,7 @@ def list_users(db: Session) -> list[dict]:
|
||||
"credential_valid": _optional_bool(account.credential_valid),
|
||||
"month_hours": account.month_hours or "",
|
||||
"official_month_hours": account.official_month_hours or "",
|
||||
"hours_source": source,
|
||||
"hours_source": account_hours_source(account),
|
||||
"monthly_target": account.monthly_target if account.monthly_target is not None else 600,
|
||||
"has_proxy": enabled(account),
|
||||
"proxy": summary_of(account),
|
||||
@@ -116,7 +115,7 @@ def _require(db: Session, employee_id: str) -> Account:
|
||||
|
||||
|
||||
def _checked_hours(client) -> tuple[str, str]:
|
||||
from admin.settings import hours_source_of
|
||||
from admin.settings import source_for_employee
|
||||
from euniv.service import _month_hours
|
||||
|
||||
try:
|
||||
@@ -124,7 +123,7 @@ def _checked_hours(client) -> tuple[str, str]:
|
||||
except Exception:
|
||||
hours = ""
|
||||
official = ""
|
||||
if hours and hours_source_of() == "history":
|
||||
if hours and source_for_employee(str(getattr(client, "login_name", "") or "")) == "history":
|
||||
reader = getattr(client, "month_hours", None)
|
||||
if callable(reader):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user