23 lines
1.1 KiB
Plaintext
23 lines
1.1 KiB
Plaintext
iteration_id = params_kw.get('iteration_id', '')
|
||
if not iteration_id:
|
||
return json.dumps({'status': 'error', 'message': '缺少iteration_id'}, ensure_ascii=False)
|
||
|
||
try:
|
||
async with get_sor_context(request._run_ns, 'pipeline') as sor:
|
||
total = await sor.sqlExe("select count(*) as cnt from sd_bugs where iteration_id=${iteration_id}$", {'iteration_id': iteration_id})
|
||
closed = await sor.sqlExe("select count(*) as cnt from sd_bugs where iteration_id=${iteration_id}$ and status=${status}$", {'iteration_id': iteration_id, 'status': 'closed'})
|
||
|
||
total_count = total[0]['cnt'] if total else 0
|
||
closed_count = closed[0]['cnt'] if closed else 0
|
||
all_closed = total_count > 0 and total_count == closed_count
|
||
|
||
return json.dumps({
|
||
'status': 'ok',
|
||
'total': total_count,
|
||
'closed': closed_count,
|
||
'all_closed': all_closed,
|
||
'message': f'共{total_count}个bug,已关闭{closed_count}个' + (',全部关闭' if all_closed else ',仍有未关闭')
|
||
}, ensure_ascii=False)
|
||
except Exception as e:
|
||
return json.dumps({'status': 'error', 'message': str(e)}, ensure_ascii=False)
|