Enforce 500 m minimum segment length in UI and API

This commit is contained in:
Davide Scaini
2026-05-13 00:56:04 +02:00
parent e9e7b5d0e7
commit 6c9de35426
2 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -53,7 +53,7 @@
$: endPct = maxIdx > 0 ? (endIdx / maxIdx) * 100 : 100;
$: selectedPolyline = gpsPoints.slice(startIdx, endIdx + 1);
$: selectedDistance = polylineDistance(selectedPolyline);
$: canSave = segName.trim().length > 0 && selectedPolyline.length >= 2 && !saving;
$: canSave = segName.trim().length > 0 && selectedPolyline.length >= 2 && selectedDistance >= 500 && !saving;
// ── Init ──────────────────────────────────────────────────────────────────
onMount(async () => {
@@ -379,6 +379,9 @@
<p class="text-xs text-zinc-400 mt-2">
Selected: <span class="text-white font-medium">{formatDistance(selectedDistance)}</span>
({selectedPolyline.length} points)
{#if selectedDistance < 500}
<span class="text-amber-400 ml-1">— minimum 500 m</span>
{/if}
</p>
</div>