from backend.db import DB db = DB() print(db.get_station_types()) db.create_event(1,1,123123,12.1231232,324.2323123,1234.213124,2424.54545)
last_client_note = note['date'] else: last_client_note = NULL_TIME_SIZE note = db.get_earliest_event_by_client(client_id, 1) if note: early_client_note = note['date'] else: early_client_note = NULL_TIME_SIZE print(last_client_note) print(early_client_note) print(abs(time1 - last_client_note), abs(time1 - early_client_note)) if abs(time1 - last_client_note) >= TIME_DIF \ and abs(time1 - early_client_note) >= TIME_DIF: print('Добавили в базу событие!') db.create_event(client_id, 1, time1, pat['latitude'], pat['longitude'], dist, speed) # print(f'Расстояние до колонки {i} - {dist} метров') # print() if DAY_START <= int(text_time) <= DAY_END: for pat in offices: dist = geodesic((lat2, lon2), (pat['latitude'], pat['longitude'])).meters if dist <= needed_dist: print( f'Сработал тригер. {val}, координаты офиса: {pat}, расстрояние: {dist}' ) note = db.get_last_event_by_client(client_id, 2) if note: last_client_note = note['date'] else: last_client_note = NULL_TIME_SIZE