remove GPX if it's already in the database, too

This commit is contained in:
Riccardo Berto 2021-03-01 15:11:59 +01:00
parent 2c19532e1b
commit 841fac5634

View File

@ -74,6 +74,7 @@ def process_gpx_files(tx: Connection):
print(f'Processing {filename}')
if list(db.execute(text('select exists(select from training where owner = :owner and filename = :filename)'),
dict(owner=owner, filename=filename,),),)[0][0]:
os.remove(filepath)
continue
with open(filepath) as f:
gpx_file = gpxpy.parse(f)