Skip to content

Commit

Permalink
Add ZRS to event signups
Browse files Browse the repository at this point in the history
search button when not preset will pull from network
  • Loading branch information
mayfield committed Dec 28, 2024
1 parent 536eba5 commit 3f02a60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pages/src/events.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ export async function main() {
} else if (action === 'collapse-subgroup' || action === 'expand-subgroup') {
const el = ev.target.closest('.event-subgroup');
el.classList.toggle('collapsed');
} else if (action === 'zrs-lookup') {
const athleteId = Number(button.closest('tr[data-id]').dataset.id);
const athlete = await common.rpc.getAthlete(athleteId, {refresh: true});
button.outerHTML = sauce.locale.human.number(athlete.racingScore);
}
} catch(e) {
// XXX
Expand Down
8 changes: 8 additions & 0 deletions pages/templates/events/subgroup.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<th class="icon"></th>
<th class="name">Name</th>
<th class="team">Team</th>
<th class="racing-score">ZRS</th>
<th class="ftp">FTP</th>
<th class="weight">Weight</th>
</tr>
Expand Down Expand Up @@ -157,6 +158,13 @@
<% } %></td>
<td class="name">{-fmtFlag(athlete.countryCode, {empty: ''})-} {{athlete.sanitizedFullname}}</td>
<td class="team"><% if (athlete.team) { %>{-teamBadge(athlete.team)-}<% } %></td>
<td class="racing-score" data-small-header="ZRS">
<% if (athlete.racingScore) { %>
{{humanNumber(athlete.racingScore)}}
<% } else { %>
<a class="button" data-action="zrs-lookup"><ms>search</ms></a>
<% } %>
</td>
<td class="power" data-small-header="FTP">{-humanPower(athlete.ftp || null, {suffix: true, html: true})-}</td>
<td class="weight" data-small-header="WEIGHT">{-humanWeightClass(athlete.weight, {suffix: true, html: true})-}</td>
</tr>
Expand Down

0 comments on commit 3f02a60

Please sign in to comment.