diff --git a/app/FSM/states.py b/app/FSM/states.py index 54bc7aa..4ec72a2 100644 --- a/app/FSM/states.py +++ b/app/FSM/states.py @@ -4,6 +4,7 @@ from aiogram.fsm.state import State, StatesGroup class SearchForm(StatesGroup): search_option = State() data_to_search = State() + sent_messages = State() search_result = State() diff --git a/app/handlers/orders.py b/app/handlers/orders.py index cbb44a6..1981d21 100644 --- a/app/handlers/orders.py +++ b/app/handlers/orders.py @@ -132,14 +132,6 @@ async def search_by_item(message: Message, state: FSMContext): async def show_order(callback: CallbackQuery, state: FSMContext, bot: Bot): order_id = int(re.search(r"(\d+)", callback.data).group()) - try: - async with async_session_() as local_session: - result = await local_session.execute(select(Order).filter(Order.id == order_id)) - order = result.scalars().first() - - except Exception as err: - logger.warning(err) - order = next(filter(lambda item: order_id == item.id, await state.get_value("search_result")), None) if order: