#!/usr/bin/env python3
import json

with open('automation/data/sustainability_topics.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

print(f'总选题数: {len(data)}')
pending = [t for t in data if t['status'] == '待处理']
avg = sum(t['total_score'] for t in pending) / len(pending) if pending else 0
print(f'待处理选题数: {len(pending)}')
print(f'待处理平均分: {avg:.1f}')
print('\n待处理选题详情:')
print('ID  标题                                     优先级    总分')
print('-' * 80)
for t in sorted(pending, key=lambda x: (-x['priority_score'], x['id'])):
    print(f"{t['id']:3}  {t['title'][:35]:35}  {t['priority']} ({t['priority_score']:2})    {t['total_score']:2}")
