def get_events_schelude(message): event_list = Event.get_all_events() print(event_list) if event_list: keyboard = InlineKeyboardMarkup(row_width=2) keys_list = [] for event in event_list: keys_list.append( InlineKeyboardButton(text=event.name, callback_data=f'schelude_{event.id}')) keys_list.append( InlineKeyboardButton(text=event.date, callback_data=f'schelude_{event.id}')) keyboard.add(*keys_list) bot.send_message( chat_id=message.from_user.id, text= f'{emojize(":man_juggling:", use_aliases=True)} Розклад заходів ' f'{emojize(":performing_arts:", use_aliases=True)}', reply_markup=keyboard) else: bot.send_message(chat_id=message.from_user.id, text='На даний час ніяких заходів не заплановано')
def get_event_visitors(call): event_keyboard = make_keyboard(keyboard_type='event', elem_list=Event.get_all_events(), marker='eventvisitor_') bot.edit_message_text(chat_id=call.from_user.id, message_id=call.message.message_id, text='Учасники якого заходу?', reply_markup=event_keyboard)
def get_event_for_del(call): event_keyboard = make_keyboard(keyboard_type='event', elem_list=Event.get_all_events(), marker='eventdelete_') bot.edit_message_text(chat_id=call.from_user.id, message_id=call.message.message_id, text='Який захід видалити?', reply_markup=event_keyboard)
def add_visitors(): if len(EventVisitor.get_all_visitors()) > 0: return else: for event in Event.get_all_events(): s_id_list = random.sample(range(1, 61), random.randint(20, 40)) for s_id in s_id_list: event_visit = EventVisitor(event_id=event.id, student_id=s_id) session.add(event_visit) session.commit() print("visitors added")