Add get_scheduled_workouts_by_year_and_month to demo and API#343
Add get_scheduled_workouts_by_year_and_month to demo and API#343hab wants to merge 2 commits intocyberjunky:masterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdded a new Garmin client method to fetch scheduled workouts by year and month, plus a demo UI menu option and handler that collect and validate year/month and call the client method. Changes
Sequence DiagramsequenceDiagram
actor User
participant Demo as demo.py
participant Client as GarminClient
participant API as GarminAPI
User->>Demo: Select menu option "u"
Demo->>Demo: Prompt for year and month
User->>Demo: Enter year and month
Demo->>Demo: Validate inputs (non-empty, int)
Demo->>Client: get_scheduled_workouts_by_year_and_month(year, month)
Client->>Client: Coerce to int and validate (year ≥ 2000, 1 ≤ month ≤ 12)
Client->>Client: Build URL (month - 1 → 0-indexed)
Client->>API: GET /calendar-service/scheduled-workouts?year=...&month=...
API-->>Client: Return scheduled workouts payload
Client-->>Demo: Return response dict
Demo-->>User: Display formatted results
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@garminconnect/__init__.py`:
- Around line 2735-2737: The validation currently checks "if year < 2000" but
raises "year must be after 2000," which is misleading because 2000 is allowed;
update the ValueError message in the check that uses the variable year (the line
"if year < 2000: raise ValueError(f\"year must be after 2000, got: {year}\")")
to accurately reflect the boundary, e.g. "year must be >= 2000, got: {year}" or
"year must be 2000 or later, got: {year}".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 669d1ee7-474f-4624-b398-08ced4fb94dd
📒 Files selected for processing (2)
demo.pygarminconnect/__init__.py
Add endpoint to retrieving schedules workouts by year and month.
Summary by CodeRabbit