- Create database tables: workout_program, program_session, person_program_assignment.
- Add Flask blueprint `routes/programs.py` with routes for creating, listing, viewing, and deleting programs.
- Implement program creation form (`templates/program_create.html`):
- Allows defining program name, description, and multiple sessions.
- Each session includes a name and dynamically added exercise selections.
- Uses `tail.select` for searchable exercise dropdowns.
- JavaScript handles dynamic addition/removal of sessions and exercises.
- Implement backend logic for program creation:
- Parses form data including multiple exercises per session.
- Automatically finds or creates non-person-specific tags based on selected exercises for each session.
- Saves program and session data, linking sessions to appropriate tags.
- Implement program list view (`templates/program_list.html`):
- Displays existing programs.
- Includes HTMX-enabled delete button for each program.
- Links program names to the view page using HTMX for dynamic loading.
- Implement program detail view (`templates/program_view.html`):
- Displays program name, description, and sessions.
- Parses session tag filters to retrieve and display associated exercises.
- Update changelog with details of the new feature.
Replaces the Plotly-based graph generation in the SQL Explorer with direct SVG rendering within an HTML template, similar to the exercise progress sparklines.
- Modifies `routes/sql_explorer.py` endpoints (`plot_query`, `plot_unsaved_query`) to fetch raw data instead of using pandas/Plotly.
- Adds `utils.prepare_svg_plot_data` to process raw SQL results, determine plot type (scatter, line, bar, table), normalize data, and prepare it for SVG.
- Creates `templates/partials/sql_explorer/svg_plot.html` to render the SVG plot with axes, ticks, labels, and basic tooltips.
- Removes the `generate_plot` function's usage for SQL Explorer and the direct dependency on Plotly for this feature.
Adds a feature to view exercise progress directly from the workout page.
- Modifies `templates/partials/topset.html`.
- Adds a graph icon next to the exercise name in the topset list.
- Clicking the icon uses HTMX to fetch and display the progress graph for that exercise inline in a new table row.
- Implements a dismiss button using hyperscript to hide the graph after viewing.
- Added functionality to export the full database schema (CREATE statements) and data (INSERT statements) as a single `.sql` file.
- Created a new route `/export/database.sql` in `routes/export.py`.
- Added helper functions to `routes/export.py` (adapted from `sql_explorer`) to generate schema CREATE statements and data INSERT statements.
- Added a download link for the SQL export to the Settings page (`templates/settings.html`).
- Updated the changelog entry for data export to include the SQL option.
- Modified the `_generate_sql_from_natural_language` helper function in `routes/sql_explorer.py` to use direct REST API calls via the `requests` library instead of the `google-generativeai` Python library.
- Added `requests` and `json` imports and removed the `google-generativeai` import.
- Updated error handling for API communication and response parsing.
- Updated the corresponding changelog entry.
- Moved endpoint listing and searching routes (`list_endpoints`, `search_endpoints`) and helper function (`get_routes`) from `app.py` into a new blueprint at `routes/endpoints.py`.
- Added `/endpoints` URL prefix to the blueprint.
- Registered the new `endpoints_bp` blueprint in `app.py`.
- Removed the original endpoint route definitions and helper function from `app.py`.
- Updated `url_for` calls in relevant templates (`endpoints.html`, `base.html`) to reference the new blueprint endpoints (e.g., `endpoints.list_endpoints`).
- Updated `templates/changelog/changelog.html` to document this refactoring.
```
Here is a conventional commit message summarizing the changes:
```
feat: Refactor SQL Explorer into blueprint
- Moved SQL Explorer routes (view explorer, save/load/execute/delete queries, view schema, plot queries) from `app.py` into a new blueprint at `routes/sql_explorer.py`.
- Added `/sql` URL prefix to the blueprint.
- Registered the new `sql_explorer_bp` blueprint in `app.py`.
- Removed the original SQL Explorer route definitions from `app.py`.
- Updated `url_for` calls in relevant templates (`sql_explorer.html`, `partials/sql_explorer/sql_query.html`, `base.html`) to reference the new blueprint endpoints (e.g., `sql_explorer.sql_explorer`).
- Updated `templates/changelog/changelog.html` to document this refactoring.
```
- Moved workout-related routes (create/delete/edit workouts, topsets, tags, start dates, show workout) from `app.py` into a new blueprint at `routes/workout.py`.
- Integrated workout view model logic from `features/workout.py` directly into `routes/workout.py` helper function `_get_workout_view_model`.
- Removed `features/workout.py` and the corresponding class instantiation in `db.py`.
- Registered the new `workout_bp` blueprint in `app.py`.
- Removed the original workout route definitions from `app.py`.
- Updated `url_for` calls in relevant templates (`workout.html`, `person_overview.html`, `partials/workout_tags.html`, `partials/topset.html`, `partials/start_date.html`, `partials/new_set_form.html`, `notes.html`, `calendar.html`) to reference the new blueprint endpoints (e.g., `workout.create_workout`).
- Updated `templates/changelog/changelog.html` to document this refactoring.
- Moved notes-related routes (viewing/editing workout notes) from `app.py` into a new blueprint at `routes/notes.py`.
- Integrated notes-specific database logic (fetching and updating notes) directly into `routes/notes.py` helper functions, removing the corresponding methods from `db.py` for better encapsulation.
- Registered the new `notes_bp` blueprint in `app.py`.
- Removed the original notes route definitions from `app.py`.
- Updated `url_for` calls in `templates/partials/workout_note.html` to reference the new blueprint endpoints (e.g., `notes.get_person_notes`).
- Updated `templates/changelog/changelog.html` to document this refactoring in its own entry.
```
feat: Refactor calendar feature into blueprint
- Moved calendar logic from `features/calendar.py` and `app.py` into a new blueprint at `routes/calendar.py`.
- Removed the `Calendar` class and refactored logic into helper functions within the blueprint module for better organization and readability.
- Eliminated the `pandas` dependency for date range generation, using standard `datetime` operations instead.
- Resolved circular import issues between `db.py`, `extensions.py`, and `routes/calendar.py` by adjusting import locations.
- Corrected `url_for` calls in templates (`calendar.html`, `partials/people_link.html`) to reference the new blueprint endpoint (`calendar.get_calendar`).
- Fixed an `AttributeError` related to HTMX request checking in the calendar route.
- Corrected `AttributeError` related to `.date()` calls on `datetime.date` objects in view processing functions.
- Updated `templates/changelog/changelog.html` to document the refactoring and associated fixes.
```
Adds a new static page accessible at /changelog to display site updates and changes manually.
- Creates a new Flask Blueprint in `routes/changelog.py` to handle the route logic.
- Registers the `changelog_bp` blueprint in `app.py`.
- Creates the corresponding template `templates/changelog/changelog.html` extending the base layout.
- Adds a link to the Changelog page in the main sidebar navigation in `templates/base.html`, using an archive icon for consistency.
- Applies basic card styling to the changelog page content for improved visual structure.