def get_team_participation_percentage(eligible=True, user_breakdown=None):
if user_breakdown is None:
user_breakdown = get_team_member_solve_stats(eligible)
team_size_any = defaultdict(list)
team_size_correct = defaultdict(list)
for tid, breakdown in user_breakdown.items():
count_any = 0
count_correct = 0
for uid, work in breakdown.items():
if work is not None:
count_any += 1
if work['correct'] > 0:
count_correct += 1
team_size_any[len(breakdown.keys())].append(count_any)
team_size_correct[len(breakdown.keys())].append(count_correct)
return {x: statistics.mean(y) for x, y in team_size_any.items()}, \
{x: statistics.mean(y) for x, y in team_size_correct.items()}
评论列表
文章目录