# pbl_evidence/api/pbl_evidence_subject_summary.dspy # M5b 契约④:学生 / 团队证据档案(设计 §3.2 list_evidence_by_student / by_team 等价实现)。 # 入参:subject_type=student|team + subject_id(或 student_id / team_id)+ blueprint_id(可选) # 出参:四类分组明细 + 产出物计数 + 水位;预览/Playtest 数据默认过滤(Q-OPEN-10)。 # dspy 铁律:无 import、无 ServerEnv()、无 f-string、显式 return; # 日志/异常一律字符串拼接(dspy-file-implementation-spec 硬规则 6)。 debug('pbl_evidence/api/pbl_evidence_subject_summary.dspy: START params_kw=' + str(dict(params_kw))) try: kw = dict(params_kw) if isinstance(kw.get('include_preview'), str): kw['include_preview'] = kw['include_preview'].strip().lower() in ('1', 'true', 'yes', 'y') if isinstance(kw.get('include_student_private'), str): kw['include_student_private'] = kw['include_student_private'].strip().lower() in ('1', 'true', 'yes', 'y') res = await pbl_evidence_subject_summary(**kw) status = 'OK' if res.get('ok') else 'ERROR' debug('pbl_evidence_subject_summary.dspy: DONE subject=' + str(res.get('subject_type')) + ':' + str(res.get('subject_id')) + ' total=' + str(res.get('evidence_total'))) result = {'status': status, 'data': res, 'message': res.get('message') or '', 'total': res.get('evidence_total')} return result except Exception as e: error('pbl_evidence_subject_summary.dspy: FAIL ' + str(format_exc())) return {'status': 'ERROR', 'data': None, 'message': str(e)}