Skip to content

Commit 3482e87

Browse files
committed
Fixed stats, alsways ask for trainingplan ID
1 parent 4d2f1bf commit 3482e87

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Make your selection:
4444
- **Total API Methods**: 100+ unique endpoints (snapshot)
4545
- **Categories**: 11 organized sections
4646
- **User & Profile**: 4 methods (basic user info, settings)
47-
- **Daily Health & Activity**: 8 methods (today's health data)
47+
- **Daily Health & Activity**: 9 methods (today's health data)
4848
- **Advanced Health Metrics**: 10 methods (fitness metrics, HRV, VO2)
4949
- **Historical Data & Trends**: 6 methods (date range queries)
5050
- **Activities & Workouts**: 21 methods (comprehensive activity management)

demo.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,11 +1815,14 @@ def get_training_plan_by_id_data(api: Garmin) -> None:
18151815
"""Get training plan details by ID (routes FBT_ADAPTIVE plans to the adaptive endpoint)."""
18161816
resp = api.get_training_plans() or {}
18171817
training_plans = resp.get("trainingPlanList") or []
1818+
18181819
if not training_plans:
1819-
print("ℹ️ No training plans found")
1820-
return
1820+
print("ℹ️ No training plans found in your list")
1821+
prompt_text = "Enter training plan ID: "
1822+
else:
1823+
prompt_text = "Enter training plan ID (press Enter for most recent): "
18211824

1822-
user_input = input("Enter training plan ID (press Enter for most recent): ").strip()
1825+
user_input = input(prompt_text).strip()
18231826
selected = None
18241827
if user_input:
18251828
try:
@@ -1847,6 +1850,9 @@ def get_training_plan_by_id_data(api: Garmin) -> None:
18471850
print("❌ Invalid plan ID")
18481851
return
18491852
else:
1853+
if not training_plans:
1854+
print("❌ No training plans available and no ID provided")
1855+
return
18501856
selected = training_plans[-1]
18511857
plan_id = int(selected["trainingPlanId"])
18521858
plan_name = selected.get("name", str(plan_id))

0 commit comments

Comments
 (0)