feat(hunt): track walking distance via GPS, show live locations on map
Docker Image CI / test (push) Failing after 41s
Docker Image CI / deploy (push) Skipped
Tests / unit (push) Failing after 36s
Tests / integration (push) Successful in 1m34s

Add foreground-only GPS distance tracking for hunts
This commit is contained in:
2026-09-27 20:55:58 +02:00
parent a0fc836c05
commit 61cc516f47
43 changed files with 2313 additions and 24 deletions
+22
View File
@@ -0,0 +1,22 @@
/**
* Team walking-distance aggregation.
*
* A team's distance is the average of the `UserTrack.distanceMeters` of its
* _current_ participants (the team owner plus its team members) that actually
* recorded a distance. Participants without a recorded track are excluded
* rather than diluting the average with zeros.
*/
export function teamAverageDistance(
participantIds: number[],
tracks: Map<number, number>
): number {
const unique = [...new Set(participantIds)];
const distances = unique
.map((id) => tracks.get(id))
.filter((d): d is number => d !== undefined);
if (distances.length === 0) return 0;
const sum = distances.reduce((acc, d) => acc + d, 0);
return Math.round(sum / distances.length);
}