def print_schedule(msg, day):
    time_list = [
        '8:30-9:15<b>|</b>9:20-10:05',
        '10:15-11:00<b>|</b>10:05-11:50',
        '12:10-12:55<b>|</b>13:00-13:45',
        '13:55-14:40<b>|</b>14:45-15:30',
        '15:50-16:35<b>|</b>16:40-17:25',
        '17:35-18:20<b>|</b>18:25-19:10'
    ]
    if User.query.filter_by(telegram_id = msg.chat.id).count() != 0:
        user = User.query.filter_by(telegram_id = msg.chat.id).first()
        group = Group.query.filter_by(id = user.group_id).first()
        days = get_schedule(str(group.group_p), day)
        schedule_string = " "
        for key in days:
            if days[key] == 'нет пары':
                schedule_string += str(key)+" <b>нет пары</b> \n" +time_list[int(key)-1]+ "\n-------------------------\n"
            else:
                time = time_list[int(key)-1]
                para = str(key)
                subject = days[key]['subject']
                room = str(days[key]['room'])
                teacher = str(days[key]['teacher'])
                schedule_string += "пара: {} \n{} \n {} \n {} \n {} \n -------------------------\n"\
                .format(para,time, subject, room, teacher)
        
        return schedule_string


    else:
        key = main_menu()
        bot.send_message(msg.chat.id, "вы не подписаны на группу")
        bot.send_message(msg.chat.id, "Выберите факультет", reply_markup=key)
        return 
def start(msg):
    key = main_menu()
    bot.send_message(msg.chat.id, "Выберите факультет", reply_markup=key)
def fr(msg):
    schedule_string =  print_schedule(msg, 'fr')
    bot.send_message(msg.chat.id, schedule_string, parse_mode="HTML")
def button_menu(msg):
    button = types.ReplyKeyboardMarkup(True)
    button.row('пн','вт','ср','чт','пт')
    button.row('/reset')
    bot.send_message(msg.chat.id, " ", reply_markup=button)