Skip to content

Commit

Permalink
Extract the inversion of dict of types for better use.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vensent committed Apr 23, 2024
1 parent 6222b22 commit 89ed833
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions run_page/tcx_to_strava_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
)


GARMIN_STRAVA_TYPE_DICT = {value: key for key, value in STRAVA_GARMIN_TYPE_DICT.items()}


def get_to_generate_files(last_time):
"""
return to values one dict for upload
Expand Down Expand Up @@ -62,11 +65,7 @@ def get_to_generate_files(last_time):
for i in to_upload_time_list:
tcx_file = to_upload_dict.get(i)["file"]
type = to_upload_dict.get(i)["type"].lower()
if type not in STRAVA_GARMIN_TYPE_DICT.values():
continue
strava_type = list(STRAVA_GARMIN_TYPE_DICT.keys())[
list(STRAVA_GARMIN_TYPE_DICT.values()).index(type)
]
strava_type = GARMIN_STRAVA_TYPE_DICT[type]
try:
upload_file_to_strava_with_type(client, tcx_file, "tcx", strava_type)
except RateLimitTimeout as e:
Expand Down

0 comments on commit 89ed833

Please sign in to comment.