Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 22, 2025

This PR implements URL parameter support for the /workout route to simplify testing without needing to modify IndexedDB directly.

Problem

Previously, testing different workout types (HIIT, LISS, strength, etc.) required manually modifying IndexedDB data through browser DevTools, which was cumbersome and time-consuming. The existing TESTING.md documentation outlined a complex process involving:

  1. Opening browser DevTools
  2. Navigating to IndexedDB storage
  3. Finding and editing workout state JSON
  4. Refreshing the page to see changes

Solution

The /workout route now accepts URL query parameters that override the stored workout state:

  • block - The block type (e.g., endurance1, powerbuilding3)
  • week - The week number (1-based)
  • day - The day number (1-based, 1-7 for each week)

Examples

Test LISS workout:

http://localhost:5173/workout?block=endurance1&week=1&day=2

Shows: LISS run for 60 minutes

Test HIIT workout:

http://localhost:5173/workout?block=powerbuilding3&week=1&day=3

Shows: Reset-20 HIIT with 20 seconds, 5 rounds

Test strength workout:

http://localhost:5173/workout?block=powerbuilding1&week=1&day=1

Shows: Bench Press and Squat strength workout

Implementation Details

  • Backward Compatibility: Normal app workflow continues to use IndexedDB stores when no parameters are provided
  • Parameter Override: URL parameters take precedence over store values when present
  • Block Resolution: Supports both training plan blocks and direct block type references
  • Error Handling: Graceful fallbacks for invalid parameters
  • Non-destructive: URL parameters don't modify stored workout progress

Benefits

  • Faster testing: No IndexedDB modification required
  • URL sharing: Developers can share specific workout URLs for collaboration
  • Comprehensive coverage: Supports all block types and workout variations
  • Developer-friendly: Simple query string syntax

Documentation

Updated TESTING.md with comprehensive URL parameter examples and moved it to the recommended testing method, while preserving the IndexedDB approach as an alternative for advanced scenarios.

![Default workout page using IndexedDB stores](https://github.com/user-attachments/assets/4d99a6f3-1ad9-4893-b3d5-a7eb3ac4685f)

Above: Default behavior showing Week 1, Day 1 - Get Ready (Rest Day) from IndexedDB

The URL parameter approach allows instant testing of any workout type without database modifications. For example, ?block=powerbuilding3&week=1&day=3 immediately loads a HIIT workout with Reset-20 activity, 20-second intervals, and 5 rounds.

Fixes #49.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • workers.cloudflare.com
    • Triggering command: node /home/REDACTED/work/Unbroken/Unbroken/node_modules/.bin/vite build (dns block)
    • Triggering command: node /home/REDACTED/work/Unbroken/Unbroken/node_modules/.bin/vite dev (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 22, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
unbroken 30580f9 Commit Preview URL

Branch Preview URL
Sep 22 2025, 02:38 PM

Co-authored-by: Bruno-366 <81762173+Bruno-366@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor /workout in order to simplify testing & Update TESTING.md Refactor /workout route to support URL parameters for easier testing Sep 22, 2025
Copilot AI requested a review from Bruno-366 September 22, 2025 14:14
@Bruno-366 Bruno-366 marked this pull request as ready for review September 22, 2025 14:44
@Bruno-366 Bruno-366 merged commit 612399b into main Sep 22, 2025
6 checks passed
@Bruno-366 Bruno-366 deleted the copilot/fix-49 branch September 22, 2025 14:46
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.

Refactor /workout in order to simplify testing & Update TESTING.md

2 participants