def get_profcomdebtor_for_del(call): debtor_id = call.data.split('_')[1] group = Group.get_group_by_id(Student.get_student_by_id(debtor_id).group_id) username = Student.get_student_by_id(debtor_id).username name = Student.get_student_by_id(debtor_id).name bot.edit_message_text(chat_id=call.from_user.id, message_id=call.message.message_id, text=f'Студент <a href="t.me/{username}">{name}</a> ' f'групи {group} видалений з боржників ' f'{emojize(":heavy_exclamation_mark:", use_aliases=True)}', parse_mode='html', disable_web_page_preview=True) ProfcomDebtor.delete_debtor(debtor_id) bot.send_message(chat_id=call.from_user.id, text='Вибери пункт меню:', reply_markup=make_role_replykeyboard(studdekan_buttons))
def prepare_event_visitors_table(event_id): visitor_ids = EventVisitor.get_visitors(event_id) stud_dict = {} otherfac_list = [] for visitor_id in visitor_ids: student = Student.get_student_by_id(visitor_id) if Group.get_group_by_id(student.group_id) == 'other': otherfac_list.append(EventVisitor.get_visitor_by_id(visitor_id).note) else: try: s_name = get_fio(student.name) s_group = f'КНТ-{Group.get_group_by_id(student.group_id)}' stud_dict.setdefault(s_group, []).append(s_name) except AttributeError: continue return stud_dict, otherfac_list
def register_on_event(call): event_id = call.data.split('_')[1] chat_id = call.from_user.id if Group.get_group_by_id( Student.get_student_by_id(chat_id).group_id) == 'other': message = bot.send_message( chat_id=chat_id, text="Введіть прізвище ім'я факультет групу\n" "<b>Наприклад:</b> <i>Петров Петро ФЕУ 123</i>", parse_mode='html') bot.register_next_step_handler(message, reg_on_event_other, event_id) else: EventVisitor.add_visitor(event_id, chat_id) bot.edit_message_text( chat_id=chat_id, message_id=call.message.message_id, text= f'Реєстрація пройшла успішно {emojize(":white_check_mark:", use_aliases=True)}' ) user = Student.get_student_by_id(chat_id)