Fix: Set both end km and traveled km in journey forms
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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]"]))
|
||||
|
||||
Reference in New Issue
Block a user