`;
data.calendarios.forEach(calendario => {
const partidos = resolvePartidos(
calendario.fase.jornada.partidos,
data.directosJornadaHoy?.partidos,
data.calendarios.length
);
if (calendario.fase?.jornada?.partidos?.length > 0) {
html += `
`;
html += `
`;
partidos.forEach(partido => {
html += partidoHtml(partido, data.competicion.deporte, data.competicion.url);
});
html += `
`;
}
});
html += `
`;
return html;
}
const phaseTranslations = {
'Round': 'Fase de grupos',
'Round of 32': 'Dieciseisavos de final',
'Round of 16': 'Octavos',
'Quarter-Finals': 'Cuartos',
'Semi-Finals': 'Semifinal',
'3rd and 4th Place': '3º y 4º puesto',
'Final': 'Final',
};
const resultsHtmlAllCompetitions = (data) => {
let html = '';
for (const [deporteName, deporte] of Object.entries(data.deportes)) {
if (deporte.haypartidos) {
html += titleHtml(deporte.deporte_para_texto);
html += ``;
deporte.competiciones.forEach(competicion => {
competicion.calendarios.forEach(calendario => {
const partidos = resolvePartidos(
calendario.fase.jornada.partidos,
data.directosJornadaHoy[competicion.id]?.partidos,
competicion.calendarios.length
)
if (calendario.fase?.jornada?.partidos?.length > 0) {
html += `
`
html += `
`
partidos.forEach(partido => {
html += partidoHtml(partido, competicion.deporte, competicion.url)
})
html += `
`
}
});
});
html += `
`;
}
}
return html;
}
const partidoHtml = (partido, deporte, competicionUrl) => {
const equipoLocalImgUrl = partido.equipoLocal.imgSVG ? `${teamBaseUrl}/${partido.equipoLocal.id}/${partido.equipoLocal.imgSVG}` : '';
const equipoVisitanteImgUrl = partido.equipoVisitante.imgSVG ? `${teamBaseUrl}/${partido.equipoVisitante.id}/${partido.equipoVisitante.imgSVG}` : '';
return `