Ejemplo n.º 1
0
def remove_last_point(message: telebot.types.Message):
    if not len(Point.select()):
        bot.send_message(message.chat.id, "Нет точек")
        return
    point = Point.select().order_by(Point.date.desc()).get()
    if point:
        point.delete_instance()
        bot.send_message(message.chat.id, "Последняя точка удалена")
Ejemplo n.º 2
0
def break_line(message: telebot.types.Message):
    if not len(Point.select()):
        bot.send_message(message.chat.id, "Нет точек")
        return
    point = Point.select().order_by(Point.date.desc()).get()
    if point:
        point.is_newline = True
        point.save()
        bot.send_message(message.chat.id, "Линия прервана")
Ejemplo n.º 3
0
async def index(request):

    points = Point.select()

    init_point = points[0] if points else default_point_factory()

    lines = [line for line in split_list(points, lambda p: p.is_newline)]

    return {
        "points": points,
        "token": yandex,
        "init_point": init_point,
        "lines": lines
    }