diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-07-09 11:41:28 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-07-09 11:41:28 +0200 |
commit | 56e4457de416a3fe16592983dabfee16075c8892 (patch) | |
tree | 5024df613873fbcb2bc57323c6b849428a34430d | |
parent | 6e0588f4cb26548344a33f8530ded631e7e85aaf (diff) | |
download | fietsboek-56e4457de416a3fe16592983dabfee16075c8892.tar.gz fietsboek-56e4457de416a3fe16592983dabfee16075c8892.tar.bz2 fietsboek-56e4457de416a3fe16592983dabfee16075c8892.zip |
take title suggestion from track name
Sometimes, the GPX itself does not have a name set, but the single
tracks might have.
-rw-r--r-- | fietsboek/views/upload.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fietsboek/views/upload.py b/fietsboek/views/upload.py index 4ce41c8..9e38069 100644 --- a/fietsboek/views/upload.py +++ b/fietsboek/views/upload.py @@ -107,10 +107,15 @@ def finish_upload(request): date = gpx.time or gpx.get_time_bounds().start_time date = date.astimezone(timezone) tz_offset = timezone.utcoffset(date) + track_name = "" + for track in gpx.tracks: + if track.name: + track_name = track.name + break return { 'preview_id': upload.id, - 'upload_title': gpx.name, + 'upload_title': gpx.name or track_name, 'upload_date': date, 'upload_date_tz': int(tz_offset.total_seconds() // 60), 'upload_visibility': Visibility.PRIVATE, |