From 33e27a4f3e9470023ccf2855448e365581f055a2 Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 23 Mar 2026 13:24:14 +0100 Subject: [PATCH] feat: add error_details to batch evaluation response - Shows first 10 errors with activity_id, training_type_id, and error message - Helps debug evaluation failures Co-Authored-By: Claude Opus 4.6 --- backend/evaluation_helper.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/evaluation_helper.py b/backend/evaluation_helper.py index f622ca2..57cf7ee 100644 --- a/backend/evaluation_helper.py +++ b/backend/evaluation_helper.py @@ -228,6 +228,9 @@ def batch_evaluate_activities( "errors": 0 } + # Track error details + error_details = [] + for activity in activities: activity_dict = dict(activity) try: @@ -246,7 +249,16 @@ def batch_evaluate_activities( except Exception as e: logger.error(f"[BATCH-EVAL] Error evaluating {activity_dict['id']}: {e}") + error_details.append({ + "activity_id": activity_dict['id'], + "training_type_id": activity_dict.get('training_type_id'), + "error": str(e) + }) stats["errors"] += 1 + # Add error details to stats (limit to first 10) + if error_details: + stats["error_details"] = error_details[:10] + logger.info(f"[BATCH-EVAL] Completed: {stats}") return stats