From e35909ac7d28b2ff36c2206396f300e4f4887ae9 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Wed, 18 Dec 2024 12:55:43 -0800 Subject: [PATCH] refactor: Subsort exercises by name when solve rates are equal --- benchmark/problem_stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/problem_stats.py b/benchmark/problem_stats.py index 34ea021cf..26db9263a 100755 --- a/benchmark/problem_stats.py +++ b/benchmark/problem_stats.py @@ -137,8 +137,8 @@ def analyze_exercise_solutions(dirs=None, topn=None): testcase = testcase[len(lang) + 1 :] exercise_stats.append((lang, testcase, num_solved, percent)) - # Sort all exercises by solve rate - exercise_stats.sort(key=lambda x: x[2], reverse=True) + # Sort all exercises by solve rate, then by exercise name + exercise_stats.sort(key=lambda x: (-x[2], x[1])) # -x[2] for descending solve rate, x[1] for ascending exercise name # Calculate max lengths for alignment after cleaning up paths max_name_len = max(len(f"{lang}/{testcase}") for lang, testcase, _, _ in exercise_stats)