insert data in training table

This commit is contained in:
Riccardo Berto 2021-02-24 11:38:34 +01:00
parent 0bf8deff30
commit d6c3e6b738

12
main.py
View File

@ -63,8 +63,16 @@ def process_gpx_files(tx: Connection, owner: str):
if gpx_file.creator != 'FitoTrack':
raise ValueError('gpx file not generated by the FitoTrack app')
training_id = list(db.execute(
'insert into training (owner, filename, medium, description) values (:owner, :filename, :medium, :description) returning id',
(owner, filename, )
"""insert into training (owner, filename, medium, description, moving_time, stopped_time, moving_distance, stopped_distance) values
(?, ?, ?, ?, ?, ?, ?, ?) returning id""",
(owner,
filename,
"",
gpx_file.description,
gpx_file.get_moving_data().moving_time,
gpx_file.get_moving_data().stopped_time,
gpx_file.get_moving_data().moving_distance,
gpx_file.get_moving_data().stopped_distance,)
))[0][0]