Skip to content

Fix training plan retrieval by updating API endpoint#310

Merged
cyberjunky merged 1 commit intocyberjunky:masterfrom
federicopellegatta:fix/training-plan-by-id-endpoint
Nov 28, 2025
Merged

Fix training plan retrieval by updating API endpoint#310
cyberjunky merged 1 commit intocyberjunky:masterfrom
federicopellegatta:fix/training-plan-by-id-endpoint

Conversation

@federicopellegatta
Copy link
Contributor

@federicopellegatta federicopellegatta commented Nov 27, 2025

This PR fixes issue #309.

The get_training_plan_by_id method was using an incorrect API endpoint:

  • Previous: /trainingplan-service/trainingplan/plans/{id}
  • Fixed: /trainingplan-service/trainingplan/phased/{id}

The old endpoint consistently returned 404 Not Found. Updating to the correct phased endpoint restores proper training plan retrieval.

Executing the same test reproduced in the issue now returns the expected result:

📋 #b 📅 Training Plans - Options
----------------------------------------
  [1] Get training plans
  [2] Get training plan by ID

  [q] Back to main menu

Make your selection: 
🔄 Executing: get_training_plan_by_id
Enter training plan ID (press Enter for most recent): 

📡 API Call: api.get_training_plan_by_id(41930814) - Piano GF Strade Bianche
--------------------------------------------------
{
  "trainingPlanId": 41930814,
  "trainingPlanCategory": "ITP",
  "trainingType": {
    "typeId": 3,
    "typeKey": "Cycling"
  },
  // ...
}

Summary by CodeRabbit

  • Bug Fixes
    • Corrected the training plan retrieval endpoint to access the proper resource, ensuring training plan data is fetched accurately from the updated location.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Walkthrough

The training plan endpoint path for get_training_plan_by_id is updated from /plans/{plan_id} to /phased/{plan_id}, changing the API resource location while maintaining existing input validation and logging behavior.

Changes

Cohort / File(s) Change Summary
Training Plan Endpoint Update
garminconnect/__init__.py
Modified get_training_plan_by_id method to use /phased/{plan_id} endpoint instead of /plans/{plan_id}

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the API endpoint for training plan retrieval to fix a 404 error issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce83437 and 2db4ade.

📒 Files selected for processing (1)
  • garminconnect/__init__.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
garminconnect/**

⚙️ CodeRabbit configuration file

garminconnect/**: - prefer modern Python patterns (3.10+)

  • use type hints consistently
  • follow PEP 8 and modern Python conventions
  • suggest performance improvements where applicable

Files:

  • garminconnect/__init__.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test (3.10)
  • GitHub Check: test (3.12)
🔇 Additional comments (1)
garminconnect/__init__.py (1)

2296-2303: Training plan endpoint change looks correct; confirm against live API

Switching get_training_plan_by_id to use "/phased/{plan_id}" (Line 2301) is consistent with the other training-plan URLs and keeps the existing validation/logging intact. Given this depends on Garmin’s backend routing, please double‑check against the live API (e.g., with the sample plan ID mentioned in the PR/issue) to ensure the response shape matches existing callers’ expectations.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cyberjunky
Copy link
Owner

Thanks for the small but important fix!

@cyberjunky cyberjunky merged commit 4d2f1bf into cyberjunky:master Nov 28, 2025
6 checks passed
@federicopellegatta federicopellegatta deleted the fix/training-plan-by-id-endpoint branch November 28, 2025 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants