From 07fbe13d688ae04abb9c067daea85a4a3ca07f74 Mon Sep 17 00:00:00 2001 From: ben_29 Date: Tue, 21 May 2024 15:31:19 +0800 Subject: [PATCH] fix: xingzhe start_time_local --- run_page/gpxtrackposter/track.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/run_page/gpxtrackposter/track.py b/run_page/gpxtrackposter/track.py index 840293939c8..a79a1358635 100644 --- a/run_page/gpxtrackposter/track.py +++ b/run_page/gpxtrackposter/track.py @@ -195,10 +195,11 @@ def _load_gpx_data(self, gpx): # determinate source if gpx.creator: self.source = gpx.creator - elif gpx.tracks[0].source: + if gpx.tracks[0].source: self.source = gpx.tracks[0].source if self.source == "xingzhe": self.start_time_local = self.start_time + self.end_time_local = self.end_time self.run_id = gpx.tracks[0].number # determinate name if gpx.name: @@ -240,9 +241,10 @@ def _load_gpx_data(self, gpx): self.start_latlng = start_point(*polyline_container[0]) except: pass - self.start_time_local, self.end_time_local = parse_datetime_to_local( - self.start_time, self.end_time, polyline_container[0] - ) + if not self.start_time_local: + self.start_time_local, self.end_time_local = parse_datetime_to_local( + self.start_time, self.end_time, polyline_container[0] + ) self.polyline_str = polyline.encode(polyline_container) self.average_heartrate = ( sum(heart_rate_list) / len(heart_rate_list) if heart_rate_list else None