Fix: can't delete a 0-point (0 km) track

The Delete / Recalculate / Refine / Compare handlers were bound inside
`if (mapEl && points.length)` in showSessionDetail, so a track with no points
(started recording, no GPS fix, stopped → 0 km) skipped the whole block and its
"Удалить" button did nothing. Moved the session-action button handlers outside
the map/points guard so they bind regardless. (Also covers a track whose points
all get dropped by the new accuracy filter.)

DB.deleteGpsSession already handled zero points fine (DELETE of 0 rows is a
no-op); the bug was purely the unbound click handler.
This commit is contained in:
4aiman 2026-08-16 20:35:08 +03:00
commit ee2880a435
4 changed files with 9 additions and 6 deletions

View file

@ -4865,9 +4865,13 @@ async function showSessionDetail(sessionId) {
session.bike_id = val;
};
}
}
// Compare button
let compareBtn = document.querySelector("#sd-compare");
// Session action buttons — bound OUTSIDE the map/points guard so a 0-point
// (0 km) track can still be deleted / recalculated / exported. Previously these
// sat inside `if (mapEl && points.length)`, so an empty track's Delete did nothing.
// Compare button
let compareBtn = document.querySelector("#sd-compare");
if (compareBtn) compareBtn.onclick = () => showCompareModal(sessionId, session, points);
// Recalculate button
@ -4936,7 +4940,6 @@ async function showSessionDetail(sessionId) {
history.back();
renderScreen("gps");
};
}
// Goal markers — closest approach for each marker
try {

2
src-tauri/Cargo.lock generated
View file

@ -139,7 +139,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "baldav"
version = "0.1.407"
version = "0.1.408"
dependencies = [
"base64 0.22.1",
"btleplug",

View file

@ -1,6 +1,6 @@
[package]
name = "baldav"
version = "0.1.407"
version = "0.1.408"
edition = "2021"
[lib]

View file

@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/nicegui/tauri-v2/refs/heads/main/tooling/cli/schema.json",
"productName": "BalDav",
"version": "0.1.407",
"version": "0.1.408",
"identifier": "dev.baldav.app",
"build": {
"frontendDist": "../frontend"