aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2023-01-10 22:03:59 +0100
committerDaniel Schadt <kingdread@gmx.de>2023-01-10 22:03:59 +0100
commit7448b77bc3fa1c4f4d00482d5d3dad766820c1e5 (patch)
tree6e8dabfb6934f8a86ee3fb9ba88b07ec9848d09a
parentcba02bdd0b8d7c10b9d25a3052e60ef9670eccf8 (diff)
downloadfietsboek-7448b77bc3fa1c4f4d00482d5d3dad766820c1e5.tar.gz
fietsboek-7448b77bc3fa1c4f4d00482d5d3dad766820c1e5.tar.bz2
fietsboek-7448b77bc3fa1c4f4d00482d5d3dad766820c1e5.zip
use GPX track description if available
-rw-r--r--CHANGELOG.rst3
-rw-r--r--fietsboek/views/upload.py8
2 files changed, 7 insertions, 4 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 8668b5c..7f4ac6b 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -26,7 +26,8 @@ Fixed
- Account registration giving a 400 error.
- Track deletion being forbidden for users.
-
+- Descriptions embedded in GPX tracks not being pre-filled when
+ uploading the track.
0.4.0 - 2022-11-28
------------------
diff --git a/fietsboek/views/upload.py b/fietsboek/views/upload.py
index 49c839c..e172339 100644
--- a/fietsboek/views/upload.py
+++ b/fietsboek/views/upload.py
@@ -114,10 +114,12 @@ def finish_upload(request):
tz_offset = timezone.utcoffset(date)
tz_offset = 0 if tz_offset is None else tz_offset.total_seconds()
track_name = ""
+ track_desc = ""
for track in gpx.tracks:
- if track.name:
+ if not track_name and track.name:
track_name = track.name
- break
+ if not track_desc and track.description:
+ track_desc = track.description
return {
"preview_id": upload.id,
@@ -126,7 +128,7 @@ def finish_upload(request):
"upload_date_tz": int(tz_offset // 60),
"upload_visibility": Visibility.PRIVATE,
"upload_type": TrackType.ORGANIC,
- "upload_description": gpx.description,
+ "upload_description": gpx.description or track_desc,
"upload_tags": set(),
"upload_tagged_people": [],
"badges": badges,