add map and clicks
This commit is contained in:
parent
45bcc13788
commit
3cfd5bdd6c
8 changed files with 1195 additions and 992 deletions
92
README.md
92
README.md
|
|
@ -1,43 +1,55 @@
|
|||
# Landkreis-Sprints
|
||||
# County Sprints frontend/leaderboard update
|
||||
|
||||
Automatische Auswertung von Landkreis-Sprints bei gemeinsamen Radausfahrten.
|
||||
Replace these files in the project:
|
||||
|
||||
## Architektur
|
||||
- `src/main.rs`
|
||||
- `src/model.rs`
|
||||
- `src/db.rs`
|
||||
- `src/leaderboard.rs`
|
||||
- `src/web.rs`
|
||||
- `migrations/0001_initial.sql`
|
||||
|
||||
```text
|
||||
Garmin / Wahoo / ...
|
||||
|
|
||||
v
|
||||
Intervals.icu
|
||||
|
|
||||
| ACTIVITY_ANALYZED
|
||||
v
|
||||
/webhooks/intervals
|
||||
|
|
||||
v
|
||||
Rust
|
||||
|
|
||||
+---- GET activity?intervals=true
|
||||
|
|
||||
+---- GET streams.json
|
||||
| time + latlng
|
||||
|
|
||||
v
|
||||
PostgreSQL
|
||||
+ PostGIS
|
||||
|
|
||||
v
|
||||
Landkreis-Grenze
|
||||
|
|
||||
v
|
||||
crossing_time
|
||||
millisecond
|
||||
|
|
||||
v
|
||||
icu_interval
|
||||
|
|
||||
v
|
||||
10-Minuten-Bucket
|
||||
|
|
||||
v
|
||||
Leaderboard
|
||||
No change is required to the working `src/intervals.rs`.
|
||||
|
||||
The existing `src/webhook.rs` can keep calling:
|
||||
|
||||
```rust
|
||||
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_groups`
|
||||
- `leaderboard_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
|
||||
|
|
|
|||
Loading…
Reference in a new issue