Exemplo n.º 1
0
def add_trackpoints_to_db(trackpoints, track):
    for trackpoint in trackpoints:
        trackpoint.track = track

        try:
            DBSession.add(trackpoint)
            DBSession.flush()
            print((trackpoint.timestamp))
        except Exception as e:
            print("\n\nTrackpoint could not be added!\n\n")
            print(e)
            DBSession.rollback()
Exemplo n.º 2
0
def add_trackpoints_to_db(trackpoints, track):
    for trackpoint in trackpoints:
        trackpoint.track = track

        try:
            DBSession.add(trackpoint)
            DBSession.flush()
            print trackpoint.timestamp
        except Exception, e:
            print "\n\nTrackpoint could not be added!\n\n"
            print e
            DBSession.rollback()
Exemplo n.º 3
0
def add_track_to_db(track_details):
    track = track_details['track']
    trackpoints = track_details['trackpoints']

    print type(track.reduced_trackpoints)
    track.uuid = str(uuid.uuid4())
    track.start_timestamp = trackpoints[0].timestamp
    track.end_timestamp = trackpoints[-1].timestamp
    try:
        DBSession.add(track)
        DBSession.flush()
    except Exception, e:
        DBSession.rollback()
        print "\n\nTrack could not be added!\n\n"
        print e
        return None
Exemplo n.º 4
0
def add_track_to_db(track_details):
    track = track_details['track']
    trackpoints = track_details['trackpoints']

    print((type(track.reduced_trackpoints)))
    track.uuid = str(uuid.uuid4())
    track.start_timestamp = trackpoints[0].timestamp
    track.end_timestamp = trackpoints[-1].timestamp
    try:
        DBSession.add(track)
        DBSession.flush()
    except Exception as e:
        DBSession.rollback()
        print("\n\nTrack could not be added!\n\n")
        print(e)
        return None
    return track