Skip to content

Commit

Permalink
Only include ZRS when it meets some basic crit
Browse files Browse the repository at this point in the history
I have concluded that ZRS is broken. :(
  • Loading branch information
mayfield committed Dec 16, 2024
1 parent 5641513 commit e04347b
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions pages/templates/events/subgroup.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<tr><td><h2><i>Loading...</i></h2></td></tr>
<% } else if (results && results.length) { %>
<% const critPowers = results[0].criticalP ? Object.keys(results[0].criticalP).map(k => [k, k.match(/criticalP([0-9]+)([A-Z][a-zA-Z]+)/)]).map(([k, m]) => [k, parseInt(m[1]) * (m[2].startsWith('Hour') ? 3600 : m[2].startsWith('Min') ? 60 : 1)]).sort((a, b) => a[1] - b[1]) : []; %>
<% const hasZRS = results.length > 1 && results.some(x => ['INCREASED', 'DECREASED', 'AT_FLOOR'].includes(x.scoreHistory?.scoreChangeType)); %>
<thead>
<tr>
<th><!--place--></th>
Expand Down Expand Up @@ -70,17 +71,23 @@
{{x.athlete.sanitizedFullname}}
</td>
<td class="team"><% if (x.athlete.team) { %>{-teamBadge(x.athlete.team)-}<% } %></td>
<td class="racing-score" data-small-header="ZRS">
<% if (x.scoreHistory) { %>
{{humanNumber(x.scoreHistory.newScore)}}
<% const delta = x.scoreHistory.newScore - x.scoreHistory.previousScore; %>
<% if (delta > 0.5) { %>
<sup class="delta {{delta > 0 ? 'positive' : 'negative'}}">+{{humanNumber(delta)}}</sup>
<% } else if (delta < -0.5) { %>
<sub class="delta {{delta > 0 ? 'positive' : 'negative'}}">{{humanNumber(delta)}}</sub>
<% if (hasZRS) { %>
<td class="racing-score" data-small-header="ZRS">
<% if (x.scoreHistory) { %>
{{humanNumber(x.scoreHistory.newScore)}}
<% const delta = x.scoreHistory.newScore - x.scoreHistory.previousScore; %>
<% if (delta > 0.5) { %>
<sup class="delta {{delta > 0 ? 'positive' : 'negative'}}">+{{humanNumber(delta)}}</sup>
<% } else if (delta < -0.5) { %>
<sub class="delta {{delta > 0 ? 'positive' : 'negative'}}">{{humanNumber(delta)}}</sub>
<% } %>
<% } else { %>
-
<% } %>
<% } %>
</td>
</td>
<% } else { %>
<td class="racing-score">-</td>
<% } %>
<% if (sg.durationInSeconds) { %>
<td class="distance" data-small-header="DIST">{-humanDistance(x.activityData.segmentDistanceInCentimeters / 100, {html: true, suffix: true})-}</td>
<% } else { %>
Expand Down

0 comments on commit e04347b

Please sign in to comment.