- booking.py: добавлен await перед get_busy_times (ошибка TypeError: coroutine is not iterable) - menu.py: возвращены emoji вместо текстовых меток - time_slots.py: возвращены emoji ❌/✅ вместо [X]/[V] - Проблема была в том, что booking_service использует async def, а вызов в booking.py был без await
21 lines
606 B
Python
21 lines
606 B
Python
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
|
from app.config import TIME_SLOTS
|
|
|
|
|
|
def get_time_keyboard(busy_times):
|
|
buttons = []
|
|
row = []
|
|
for slot in TIME_SLOTS:
|
|
busy = slot in busy_times
|
|
if busy:
|
|
label = "\u274c" + " " + slot
|
|
else:
|
|
label = "\u2705" + " " + slot
|
|
row.append(InlineKeyboardButton(text=label, callback_data="time_" + slot))
|
|
if len(row) == 3:
|
|
buttons.append(row)
|
|
row = []
|
|
if row:
|
|
buttons.append(row)
|
|
return InlineKeyboardMarkup(inline_keyboard=buttons)
|