aboutsummaryrefslogtreecommitdiff
path: root/web/templates.templ
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-09-25 08:46:58 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-09-25 08:46:58 +0200
commit077aa1700fbcaf3f499c2178e0e58e89ae9dcaf8 (patch)
tree020d0d8b34ab7b47cf551b50034c1e086a247af3 /web/templates.templ
parent90614736f2a0c556f31eca5361b3c032f5f309f6 (diff)
Chart power vs time for official climb attempts
Snapshot average power per attempt in a nullable average_power_w column (backfilled from stored rides), plot each powered attempt on the climb page as duration vs average watts with ride hover and click-through, and show avg power in the attempts table.
Diffstat (limited to 'web/templates.templ')
-rw-r--r--web/templates.templ10
1 files changed, 8 insertions, 2 deletions
diff --git a/web/templates.templ b/web/templates.templ
index aceeeee..6a0109f 100644
--- a/web/templates.templ
+++ b/web/templates.templ
@@ -563,19 +563,25 @@ templ ClimbDetailContent(data ClimbDetailPageData) {
if len(data.Attempts) == 0 {
<div class="empty">No attempts recorded yet. Open a ride containing this climb to record one.</div>
} else {
+ if len(data.AttemptPoints) > 0 {
+ <div class="analytics-chart"><canvas id="climb-attempts-chart" data-climb-attempts-chart tabindex="0" role="img" aria-label={ attemptsChartLabel(data.Climb.Name) }></canvas></div>
+ <output class="analytics-hover" data-attempts-hover aria-live="polite">Hover a point to inspect an attempt.</output>
+ }
<table>
- <thead><tr><th>Date</th><th>Ride</th><th class="numeric">Time</th><th class="numeric">Distance</th><th class="numeric">Cotacol</th></tr></thead>
+ <thead><tr><th>Date</th><th>Ride</th><th class="numeric">Time</th><th class="numeric">Avg power</th><th class="numeric">Distance</th><th class="numeric">Cotacol</th></tr></thead>
<tbody>
for _, attempt := range data.Attempts {
- <tr><td>{ attempt.Date }</td><td><a href={ templ.URL(rideDetailURL(attempt.RideID)) }>{ attempt.RideName }</a></td><td class="numeric">{ attempt.Duration }</td><td class="numeric">{ attempt.Distance }</td><td class="numeric">{ attempt.Cotacol }</td></tr>
+ <tr><td>{ attempt.Date }</td><td><a href={ templ.URL(rideDetailURL(attempt.RideID)) }>{ attempt.RideName }</a></td><td class="numeric">{ attempt.Duration }</td><td class="numeric">{ formatPower(attempt.AveragePowerW) }</td><td class="numeric">{ attempt.Distance }</td><td class="numeric">{ attempt.Cotacol }</td></tr>
}
</tbody>
</table>
}
</section>
@templ.JSONScript("climb-profile-data", data.Profile)
+ @templ.JSONScript("climb-attempt-points", data.AttemptPoints)
@templ.JSONScript("climb-endpoints", data.Endpoints)
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script type="module" src="/static/climb-profile.js"></script>
+ <script type="module" src="/static/climb-attempts.js"></script>
<script type="module" src="/static/climb-map.js"></script>
}