{% set entityRelatedId = '' %}
{% if cranking.competicion is not null %}
{% set entityRelatedId = cranking.competicion.id %}
{% elseif cranking.externalCompetition is not null %}
{% set entityRelatedId = cranking.externalCompetition.id %}
{% endif %}
{% set keyEntity = clasificadoRankingId ~ '-' ~ entityRelatedId %}
{% set puntuacion = "" %}
{% set data = 0 %}
{% set tooltip = 0 %}
{% if puntos[clasificadoRankingId][keyEntity]['puntos'] is defined and (not puntos[clasificadoRankingId][keyEntity]['puntos'] is null) %}
{% set puntuacion = puntos[clasificadoRankingId][keyEntity]['puntos'] %}
{% set data = 1 %}
{% if puntos[clasificadoRankingId][keyEntity]['penalidad'] is defined and (not puntos[clasificadoRankingId][keyEntity]['penalidad'] is null) %}
{% set tooltip = 1 %}
{% if isMedal %}
{% set puntuacion = puntuacion + puntos[clasificadoRankingId][keyEntity]['penalidad'] %}
{% else %}
{% set puntuacion = puntuacion - puntos[clasificadoRankingId][keyEntity]['penalidad'] %}
{% endif %}
{% endif %}
{% if puntos[clasificadoRankingId][keyEntity]['bonus'] is defined and (not puntos[clasificadoRankingId][keyEntity]['bonus'] is null) %}
{% set tooltip = 1 %}
{% if isMedal %}
{% set puntuacion = puntuacion - puntos[clasificadoRankingId][keyEntity]['bonus'] %}
{% else %}
{% set puntuacion = puntuacion + puntos[clasificadoRankingId][keyEntity]['bonus'] %}
{% endif %}
{% endif %}
{% endif %}
{% if puntuacion < 0 %}
{% set puntuacion = 0 %}
{% endif %}
<div class="tableCell tableCell-competicion
{% if puntos[clasificadoRankingId] is defined and puntos[clasificadoRankingId][keyEntity] is defined and puntos[clasificadoRankingId][keyEntity]['mejor_prueba'] is defined and puntos[clasificadoRankingId][keyEntity]['mejor_prueba'] %} puntuable {% endif %}"
{% if tooltip > 0 %}
data-content="{% if puntos[clasificadoRankingId][keyEntity]['puntos'] ?? false %}Puntos: {{ puntos[clasificadoRankingId][keyEntity]['puntos']|default(null) }}{% endif %}
{% if puntos[clasificadoRankingId][keyEntity]['penalidad'] ?? 0 != 0 %} | Penalidad: {{ puntos[clasificadoRankingId][keyEntity]['penalidad'] }}{% endif %}
{% if puntos[clasificadoRankingId][keyEntity]['bonus'] ?? 0 != 0 %} | Bonus: {{ puntos[clasificadoRankingId][keyEntity]['bonus'] }}{% endif %}"
data-inverted=""
{% endif %}
>
<a class="cell-points"
{% if puntos[clasificadoRankingId] is defined and puntos[clasificadoRankingId][keyEntity] is defined and puntos[clasificadoRankingId][keyEntity]['inscrito'] is defined and cranking.competicion is not null %}href="javascript:cardOpener({{ puntos[clasificadoRankingId][keyEntity]['inscrito'] }}, 0);"{% endif %}>
<span>{% if data %}{{ puntuacion + 0 }}{% else %}-{% endif %}</span>
<span class="icon-penalty">{% if data and puntos[clasificadoRankingId][keyEntity]['penalidad'] is defined and (not puntos[clasificadoRankingId][keyEntity]['penalidad'] is null) %}
<svg class="icon-bonus-penalty" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M16 4c6.6 0 12 5.4 12 12s-5.4 12-12 12S4 22.6 4 16S9.4 4 16 4m0-2C8.3 2 2 8.3 2 16s6.3 14 14 14s14-6.3 14-14S23.7 2 16 2"></path><path fill="currentColor" d="M8 15h16v2H8z"></path></svg>{% endif %}</span>
<span class="icon-bonus">{% if data and puntos[clasificadoRankingId][keyEntity]['bonus'] is defined and (not puntos[clasificadoRankingId][keyEntity]['bonus'] is null) %}
<svg class="icon-bonus-penalty" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M16 4c6.6 0 12 5.4 12 12s-5.4 12-12 12S4 22.6 4 16S9.4 4 16 4m0-2C8.3 2 2 8.3 2 16s6.3 14 14 14s14-6.3 14-14S23.7 2 16 2"></path><path fill="currentColor" d="M24 15h-7V8h-2v7H8v2h7v7h2v-7h7z"></path></svg>{% endif %}</span>
</a>
</div>