diff options
| author | Daniel Schadt <kingdread@gmx.de> | 2025-11-12 19:35:34 +0100 |
|---|---|---|
| committer | Daniel Schadt <kingdread@gmx.de> | 2025-11-12 19:35:54 +0100 |
| commit | 1fefd72e884296f7a4454d3534f5bcc3ac3e2299 (patch) | |
| tree | b1a1599d8d259944f3c0212034d7b73b3c1f887e | |
| parent | 7796cfef6aca9232f1d31fa84fdaa50cb4bb2414 (diff) | |
| download | fietsboek-1fefd72e884296f7a4454d3534f5bcc3ac3e2299.tar.gz fietsboek-1fefd72e884296f7a4454d3534f5bcc3ac3e2299.tar.bz2 fietsboek-1fefd72e884296f7a4454d3534f5bcc3ac3e2299.zip | |
respect track date when downgradinggpx-influx
| -rw-r--r-- | fietsboek/updater/scripts/upd_20251109_nm561argcq1s8w27.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fietsboek/updater/scripts/upd_20251109_nm561argcq1s8w27.py b/fietsboek/updater/scripts/upd_20251109_nm561argcq1s8w27.py index 05a7233..e3e5e47 100644 --- a/fietsboek/updater/scripts/upd_20251109_nm561argcq1s8w27.py +++ b/fietsboek/updater/scripts/upd_20251109_nm561argcq1s8w27.py @@ -108,13 +108,17 @@ class Down(UpdateScript): connection = engine.connect() data_dir = Path(config["fietsboek.data_dir"]) - query = text("SELECT id, title, description FROM tracks;") + query = text("SELECT id, title, description, date_raw FROM tracks;") for row in connection.execute(query): gpx = gpxpy.gpx.GPX() gpx.description = row.description gpx.name = row.title + start_date = row.date_raw + if isinstance(start_date, str): + start_date = datetime.datetime.fromisoformat(start_date) + segment = gpxpy.gpx.GPXTrackSegment() points_query = text(""" SELECT longitude, latitude, elevation, time_offset @@ -126,9 +130,7 @@ class Down(UpdateScript): latitude=point.latitude, longitude=point.longitude, elevation=point.elevation, - # This is wrong, should take proper track start time - # into account: - time=datetime.datetime.fromtimestamp(point.time_offset), + time=start_date + datetime.timedelta(seconds=point.time_offset), ) ) track = gpxpy.gpx.GPXTrack() |
