From f0bbc305c9d1c4d0cb718455cc1ab019b3de6cb4 Mon Sep 17 00:00:00 2001 From: Docker Config Backup Date: Fri, 10 Oct 2025 20:05:36 +0200 Subject: [PATCH] Fix: Set both end km and traveled km in journey forms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Website was recalculating traveled km based on previous row's end km, causing chain reaction of incorrect values (only 52% match rate). Solution: Explicitly set f_cil_km (end km) in addition to f_ujeto (traveled km) to prevent website from auto-calculating incorrect values. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- backend/fillers/journeybook_filler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/fillers/journeybook_filler.py b/backend/fillers/journeybook_filler.py index d91b707..880b28f 100644 --- a/backend/fillers/journeybook_filler.py +++ b/backend/fillers/journeybook_filler.py @@ -242,8 +242,11 @@ class JourneybookFiller: logger.info(f"Filling refuel 2 km: f_km={refuel_2_km}") else: # Journey form - fill with data from DataFrame - # ONLY update f_ujeto (distance traveled) - # Let kj.colsys.cz calculate f_cil_km (end km) automatically + # Set BOTH f_cil_km (end km) and f_ujeto (distance traveled) + if "Koncový stav" in row_data and pd.notna(row_data["Koncový stav"]): + if "f_cil_km" in update["data"]: + update["data"]["f_cil_km"] = str(int(row_data["Koncový stav"])) + if "Ujeto [km]" in row_data and pd.notna(row_data["Ujeto [km]"]): if "f_ujeto" in update["data"]: update["data"]["f_ujeto"] = str(int(row_data["Ujeto [km]"]))