From cbbed026c14afa425f9417f8ee89aa5c280dccc7 Mon Sep 17 00:00:00 2001 From: "Ubuntu 20.04.4 LTS" Date: Wed, 11 Oct 2023 08:27:18 +0200 Subject: [PATCH] fix route start without any steps --- bot/handlers/route.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bot/handlers/route.py b/bot/handlers/route.py index 8b7e152..cfb7e06 100644 --- a/bot/handlers/route.py +++ b/bot/handlers/route.py @@ -77,9 +77,13 @@ async def route_selection( await answer_with_delay(message, state, NO_ROUTES) return - routes = {route.name: route for route in db_routes[:3] if route.stages} + routes = { + route.name: route + for route in db_routes[:3] + if any(route.stages) + } - if await state.get_state() != Route.selection: + if routes and await state.get_state() != Route.selection: await state.set_state(Route.selection) await answer_with_delay( message,