From ee2880a435e8ffe7cf26e33fb53d8f32b04cc3e5 Mon Sep 17 00:00:00 2001 From: 4aiman Date: Sun, 16 Aug 2026 20:35:08 +0300 Subject: [PATCH] Fix: can't delete a 0-point (0 km) track MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- frontend/js/main.js | 9 ++++++--- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/js/main.js b/frontend/js/main.js index 06168ae..a29f4e3 100644 --- a/frontend/js/main.js +++ b/frontend/js/main.js @@ -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 { diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 07fd302..f357256 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -139,7 +139,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "baldav" -version = "0.1.407" +version = "0.1.408" dependencies = [ "base64 0.22.1", "btleplug", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index c6b1104..2dd8e04 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "baldav" -version = "0.1.407" +version = "0.1.408" edition = "2021" [lib] diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 5a7b407..3e3d691 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -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"