- Rust 92.7%
- Nix 5.4%
- Shell 1.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
'Alle sichtbaren importieren' used to POST a plain form, which
synchronously imported every visible activity server-side and only
then redirected via a meta refresh -- the browser just sat on a
blank reload for however long the whole batch took, with no
per-activity feedback.
Each activity row now carries data-athlete-id/data-activity-id plus
a progress bar and status line. Both the per-row 'Analysieren'
button and the 'Alle sichtbaren importieren' button now drive a
small JS loop that POSTs to the existing
/sync/{athlete}/activities/{activity}/import endpoint per activity
with Accept: application/json, animates that row's progress bar
while the request is in flight, and shows the resulting crossing
count (or an error) inline -- without a full page reload.
The endpoint itself now branches on the Accept header: JSON for the
AJAX path, the previous meta-refresh HTML for plain form submits
(so it still works without JavaScript). process_activity and
process_activity_with_client now return the crossing count so it
can be reported back to the row.
|
||
| migrations | ||
| scripts | ||
| src | ||
| .env.example | ||
| .gitignore | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
| rust-toolchain.toml | ||
County Sprints frontend/leaderboard update
Replace these files in the project:
src/main.rssrc/model.rssrc/db.rssrc/leaderboard.rssrc/web.rsmigrations/0001_initial.sql
No change is required to the working src/intervals.rs.
The existing src/webhook.rs can keep calling:
crate::process_activity(state_clone, athlete_id, activity_id.clone()).await
process_activity() now loads the athlete's OAuth access token itself. The development sync uses the explicit API-key client, so the personal development key is not written to the database.
Database
The migration is intentionally a complete replacement because the database can be reset during development.
The new schema adds:
leaderboard_groupsleaderboard_group_members- indexes for activity/crossing queries
Leaderboard location matching
Leaderboard rows are grouped by:
- 10-minute time bucket
- source county
- destination county
- spatial cluster with a 10 metre DBSCAN radius
The crossing geometry is transformed to EPSG:3857 before the 10 metre clustering calculation so the distance is measured in metres rather than degrees.
Frontend
The frontend now provides:
- Leaflet map for each leaderboard group
- small map for every individual crossing
- activity detail page at
/activity/{activity_id} - activity map containing all crossings
- browser-local timestamp formatting using
Intl.DateTimeFormat - leaderboard group management at
/groups - group selection on the main leaderboard
The map uses Leaflet and OpenStreetMap tiles. Leaflet's current stable 1.x documentation describes the same map/tile-layer APIs used here. citeturn0search2turn0search9