Add detailed logging to fixtures API to debug match processing

parent 80a5421b
...@@ -10777,18 +10777,23 @@ def get_overlay_fixtures(): ...@@ -10777,18 +10777,23 @@ def get_overlay_fixtures():
# Combine matches: yesterday first (if any incomplete), then today # Combine matches: yesterday first (if any incomplete), then today
all_matches = [] all_matches = []
if yesterday_incomplete_matches: if yesterday_incomplete_matches:
logger.debug(f"Found {len(yesterday_incomplete_matches)} incomplete matches from yesterday - including them") logger.info(f"[FIXTURES API] Found {len(yesterday_incomplete_matches)} incomplete matches from yesterday - including them")
all_matches.extend(yesterday_incomplete_matches) all_matches.extend(yesterday_incomplete_matches)
all_matches.extend(today_matches) all_matches.extend(today_matches)
# Limit to 5 matches total # Limit to 5 matches total
display_matches = all_matches[:5] display_matches = all_matches[:5]
logger.info(f"[FIXTURES API] Processing {len(display_matches)} matches for display")
fixtures_data = [] fixtures_data = []
for match in display_matches: for i, match in enumerate(display_matches):
try:
logger.info(f"[FIXTURES API] Processing match {i+1}: id={match.id}, match_number={match.match_number}")
# Get outcomes from MatchOutcomeModel # Get outcomes from MatchOutcomeModel
outcomes = session.query(MatchOutcomeModel).filter_by(match_id=match.id).all() outcomes = session.query(MatchOutcomeModel).filter_by(match_id=match.id).all()
logger.info(f"[FIXTURES API] Found {len(outcomes)} outcomes for match {match.id}")
# Format outcomes as array expected by template # Format outcomes as array expected by template
outcomes_array = [] outcomes_array = []
...@@ -10827,8 +10832,12 @@ def get_overlay_fixtures(): ...@@ -10827,8 +10832,12 @@ def get_overlay_fixtures():
} }
} }
fixtures_data.append(match_data) fixtures_data.append(match_data)
logger.info(f"[FIXTURES API] Successfully processed match {match.id}")
except Exception as match_error:
logger.error(f"[FIXTURES API] Error processing match {match.id}: {match_error}")
continue
logger.debug(f"Retrieved {len(fixtures_data)} matches from database (yesterday: {len(yesterday_incomplete_matches)}, today: {len(today_matches)})") logger.info(f"[FIXTURES API] Returning {len(fixtures_data)} matches")
return jsonify(fixtures_data) return jsonify(fixtures_data)
finally: finally:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment