Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: subtype issue #744

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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