Fix match template: handle outcomes array format correctly

parent 40ccb77e
......@@ -1168,16 +1168,19 @@
const venue = nextMatch.venue_kampala_township || nextMatch.venue || 'TBD';
matchVenue.textContent = venue;
// Get outcomes for this match (comes as object/dict from database)
let outcomes = nextMatch.outcomes || {};
console.log('DEBUG: Raw outcomes object:', outcomes);
// Get outcomes for this match (comes as array from API)
let outcomes = nextMatch.outcomes || [];
console.log('DEBUG: Raw outcomes:', outcomes);
console.log('DEBUG: Outcomes type:', typeof outcomes);
console.log('DEBUG: Outcomes keys:', Object.keys(outcomes));
console.log('DEBUG: Is array:', Array.isArray(outcomes));
// Convert outcomes object to array format for processing
// Convert outcomes to array format for processing
let outcomesArray = [];
if (typeof outcomes === 'object' && outcomes !== null) {
// Handle dict format from database
if (Array.isArray(outcomes)) {
// Handle array format from API
outcomesArray = outcomes;
} else if (typeof outcomes === 'object' && outcomes !== null) {
// Handle dict format from database (fallback)
Object.entries(outcomes).forEach(([key, value]) => {
outcomesArray.push({
outcome_name: key,
......
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