feat: taller route tiles (h-46), labels overlay above route line for more place names, renamed auto routes become custom (rename clears auto_detected + startup backfill)
This commit is contained in:
@@ -179,6 +179,9 @@ async def update_route(
|
||||
raise HTTPException(status_code=404, detail="Route not found")
|
||||
if body.name is not None and body.name.strip():
|
||||
route.name = body.name.strip()
|
||||
# A user-given name makes this a custom route (moves it out of the
|
||||
# auto-detected group on the routes page).
|
||||
route.auto_detected = False
|
||||
if body.sport_type is not None:
|
||||
route.sport_type = body.sport_type
|
||||
await db.commit()
|
||||
|
||||
@@ -189,6 +189,20 @@ async def init_db():
|
||||
except Exception as e:
|
||||
print(f"avg_speed_ms fix skipped: {e}")
|
||||
|
||||
# An auto-detected route the user has renamed should count as a custom route.
|
||||
# Auto names are generated as "<Sport> route <DD Mon YYYY>"; any auto_detected
|
||||
# route whose name no longer matches that pattern has been renamed → mark it
|
||||
# custom so it groups with user-named routes.
|
||||
try:
|
||||
async with engine.begin() as conn:
|
||||
await conn.execute(text(
|
||||
"UPDATE named_routes SET auto_detected = false "
|
||||
"WHERE auto_detected = true "
|
||||
"AND name !~ '^.+ route [0-9]{1,2} [A-Za-z]{3} [0-9]{4}$'"
|
||||
))
|
||||
except Exception as e:
|
||||
print(f"route auto_detected backfill skipped: {e}")
|
||||
|
||||
# Seed admin user (only if password is configured)
|
||||
if not settings.admin_password:
|
||||
print("ADMIN_PASSWORD not set - skipping admin user seed")
|
||||
|
||||
Reference in New Issue
Block a user