Skip to content

Commit

Permalink
fix: subtype issue (#744)
Browse files Browse the repository at this point in the history
* fix: subtype issue

Signed-off-by: yihong0618 <[email protected]>

* fix: drop nrc dead code

Signed-off-by: yihong0618 <[email protected]>

---------

Signed-off-by: yihong0618 <[email protected]>
  • Loading branch information
yihong0618 authored Nov 25, 2024
1 parent fb4290a commit 23f5824
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 16 deletions.
1 change: 1 addition & 0 deletions run_page/codoon_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ def parse_raw_data_to_namedtuple(
"id": log_id,
"name": str(cast_type) + " from codoon",
"type": cast_type,
"subtype": cast_type,
"start_date": datetime.strftime(start_date, "%Y-%m-%d %H:%M:%S"),
"end": datetime.strftime(end_date, "%Y-%m-%d %H:%M:%S"),
"start_date_local": datetime.strftime(start_date, "%Y-%m-%d %H:%M:%S"),
Expand Down
1 change: 1 addition & 0 deletions run_page/endomondo_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def parse_run_endomondo_to_nametuple(en_dict):
"id": en_dict.get("id"),
"name": "run from endomondo",
"type": "Run", # TODO others
"subtype": "Run", # TODO others
"start_date": datetime.strftime(start_date, "%Y-%m-%d %H:%M:%S"),
"end": datetime.strftime(end_date, "%Y-%m-%d %H:%M:%S"),
"start_date_local": datetime.strftime(start_date_local, "%Y-%m-%d %H:%M:%S"),
Expand Down
1 change: 1 addition & 0 deletions run_page/joyrun_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ def parse_raw_data_to_nametuple(self, run_data, old_gpx_ids, with_gpx=False):
"name": "run from joyrun",
# future to support others workout now only for run
"type": "Run",
"subtype": "Run",
"start_date": datetime.strftime(start_date, "%Y-%m-%d %H:%M:%S"),
"end": datetime.strftime(end, "%Y-%m-%d %H:%M:%S"),
"start_date_local": datetime.strftime(
Expand Down
1 change: 1 addition & 0 deletions run_page/keep_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def parse_raw_data_to_nametuple(
"name": f"{KEEP2STRAVA[run_data['dataType']]} from keep",
# future to support others workout now only for run
"type": f"{KEEP2STRAVA[(run_data['dataType'])]}",
"subtype": f"{KEEP2STRAVA[(run_data['dataType'])]}",
"start_date": datetime.strftime(start_date, "%Y-%m-%d %H:%M:%S"),
"end": datetime.strftime(end, "%Y-%m-%d %H:%M:%S"),
"start_date_local": datetime.strftime(start_date_local, "%Y-%m-%d %H:%M:%S"),
Expand Down
17 changes: 1 addition & 16 deletions run_page/nike_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,6 @@ class Nike:
def __init__(self, access_token):
self.client = httpx.Client()

# HINT: if you have old nrc refresh_token un comments this lines it still works

# response = self.client.post(
# TOKEN_REFRESH_URL,
# headers=NIKE_HEADERS,
# json={
# "refresh_token": access_token, # its refresh_token for tesy here
# "client_id": b64decode(NIKE_CLIENT_ID).decode(),
# "grant_type": "refresh_token",
# "ux_id": b64decode(NIKE_UX_ID).decode(),
# },
# timeout=60,
# )
# response.raise_for_status()
# access_token = response.json()["access_token"]

self.client.headers.update({"Authorization": f"Bearer {access_token}"})

def get_activities_since_timestamp(self, timestamp):
Expand Down Expand Up @@ -361,6 +345,7 @@ def parse_no_gpx_data(activity):
"id": int(nike_id),
"name": "run from nike",
"type": "Run",
"subtype": "Run",
"start_date": datetime.strftime(start_date, "%Y-%m-%d %H:%M:%S"),
"end": datetime.strftime(end_date, "%Y-%m-%d %H:%M:%S"),
"start_date_local": datetime.strftime(start_date_local, "%Y-%m-%d %H:%M:%S"),
Expand Down
1 change: 1 addition & 0 deletions run_page/oppo_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ def parse_raw_data_to_name_tuple(sport_data, with_gpx, with_tcx):
"name": "activity from oppo",
# future to support others workout now only for run
"type": map_oppo_fit_type_to_strava_activity_type(sport_data["sportMode"]),
"subtype": map_oppo_fit_type_to_strava_activity_type(sport_data["sportMode"]),
"start_date": datetime.strftime(start_date, "%Y-%m-%d %H:%M:%S"),
"end": datetime.strftime(end, "%Y-%m-%d %H:%M:%S"),
"start_date_local": datetime.strftime(start_date_local, "%Y-%m-%d %H:%M:%S"),
Expand Down
1 change: 1 addition & 0 deletions run_page/tulipsport_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def get_all_activity_summaries(session, headers, start_time=None):
"moving_time": moving_time,
"elapsed_time": moving_time,
"type": "Run",
"subtype": "Run",
"start_date": start_date,
"start_date_local": start_date_local,
"end_date": start_date + moving_time,
Expand Down

0 comments on commit 23f5824

Please sign in to comment.