pbl_evidence/wwwroot/api/pbl_evidence_query.dspy
2026-09-22 14:13:03 +08:00

22 lines
1.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# pbl_evidence/api/pbl_evidence_query.dspy
# M5b 契约③:证据分页查询(含 timestamp + payload,US-17「证据不只是分数」)。
# 支持 blueprint_id / learner_id / session_id / artifact_id / evidence_type /
# evidence_types / time_from,time_to / page / rows;预览数据默认过滤(Q-OPEN-10)。
# dspy 铁律:无 import、无 ServerEnv()、显式 return。
debug(f'pbl_evidence/api/pbl_evidence_query.dspy: START params_kw={dict(params_kw)}')
try:
kw = dict(params_kw)
for flag in ('include_preview', 'include_student_private'):
if isinstance(kw.get(flag), str):
kw[flag] = kw[flag].strip().lower() in ('1', 'true', 'yes', 'y')
res = await pbl_evidence_query(**kw)
status = 'OK' if res.get('ok') else 'ERROR'
debug(f'pbl_evidence_query.dspy: DONE total={res.get("total")} '
f'page={res.get("page")} rows={len(res.get("rows") or [])}')
return {'status': status, 'data': res, 'message': res.get('message') or '',
'total': res.get('total')}
except Exception as e:
error(f'pbl_evidence_query.dspy: FAIL {format_exc()}')
return {'status': 'ERROR', 'data': None, 'message': str(e)}