369 Commits

Author SHA1 Message Date
Peter Stockings
dd82f461be feat: Add workout program management
- 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.
2025-04-24 20:17:30 +10:00
Peter Stockings
e7d125d57b Move workout tag logic into tags blueprint 2025-04-21 20:13:30 +10:00
Peter Stockings
c88d28b47c Fix issue with newly added workout tags not being rendered 2025-04-20 17:05:32 +10:00
Peter Stockings
7aa7f9b8dc Partial refactor of tags functionality
Still need to move tags db logic to BP and move workout tag logic to BP as well
2025-04-19 21:10:34 +10:00
Peter Stockings
e947feb3e3 refactor(sql_explorer): Replace Plotly with SVG rendering for plots
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.
2025-04-15 19:34:26 +10:00
Peter Stockings
51ec18c461 feat: Add dismissible exercise progress graph to workout page
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.
2025-04-13 19:20:53 +10:00
Peter Stockings
3da0dc3b3d Fix for regression where selecting exercise for a new set on an exercise that hasnt had an set recorded wouldnt diplay the name 2025-04-13 18:04:11 +10:00
Peter Stockings
62e203bc2a feat: Add SQL script export option
- 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.
2025-04-12 21:17:19 +10:00
Peter Stockings
2d67badd32 Remove comments from generated SQL queries 2025-04-05 21:51:56 +11:00
Peter Stockings
64dda01af6 Add on requests==2.26.0 to requirements.txt 2025-04-05 21:38:17 +11:00
Peter Stockings
ead73e8190 Add instructions on how to set Gemni model 2025-04-05 21:29:41 +11:00
Peter Stockings
bd8a3fcdb2 refactor: Use REST API for Gemini SQL generation
- 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.
2025-04-05 21:17:56 +11:00
Peter Stockings
b875b49eca feat: Refactor endpoint listing into blueprint
- 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.
```
2025-03-31 23:15:24 +11:00
Peter Stockings
a8fe28339b I have refactored the SQL Explorer functionality into its own blueprint (routes/sql_explorer.py) with a /sql URL prefix. This involved moving the relevant routes from app.py, registering the new blueprint, removing the old routes, updating url_for calls in the templates, and documenting the change in the changelog.
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.
```
2025-03-31 23:00:54 +11:00
Peter Stockings
eaeb4ab2c8 feat: Refactor workout functionality into blueprint
- 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.
2025-03-31 22:38:48 +11:00
Peter Stockings
78436b230b feat: Refactor notes functionality into blueprint
- 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.
2025-03-31 22:08:47 +11:00
Peter Stockings
6095e76f10 Here is a conventional commit message summarizing the refactoring work:
```
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.
```
2025-03-30 22:20:48 +11:00
Peter Stockings
4a822ea2ba Update python buildpack version to reflect archived state 2025-03-30 22:02:09 +11:00
Peter Stockings
2465cad005 feat: Add static changelog page
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.
2025-03-30 21:30:25 +11:00
Peter Stockings
39e91f2655 Add support to set degree of line of best fit for exercise progress graphs in custom view 2025-02-06 23:43:10 +11:00
Peter Stockings
116de33df3 Update load_user function 2025-02-02 17:45:54 +11:00
Peter Stockings
b0296be9a0 On SQL explorer page add a button to copy the create tables database schema 2025-02-01 23:50:09 +11:00
Peter Stockings
5be7438afc Add in auth however there are no restrictions currently 2025-02-01 22:42:58 +11:00
Peter Stockings
fb0e1519e4 Include Plotly js lib 2025-02-01 21:26:52 +11:00
Peter Stockings
c1c4c4a960 Speed up sql plot generation 2025-02-01 21:06:21 +11:00
Peter Stockings
5fe003bcbf Add loading icons to sql plot and add clear button to results container 2025-02-01 21:06:01 +11:00
Peter Stockings
8b02307397 Add plot functionality to unsaved sql query and use htmx 2025-02-01 20:26:54 +11:00
Peter Stockings
55149c5ea9 Switch stats from camel case to snake case 2025-02-01 19:48:56 +11:00
Peter Stockings
677d44320c Fix for workout view showing sets out of order 2025-02-01 19:38:08 +11:00
Peter Stockings
07c2111b55 Remove unused functions from app.py 2025-01-27 14:54:31 +11:00
Peter Stockings
f70438e4e4 Refactor dashboard 2025-01-27 14:46:20 +11:00
Peter Stockings
a7592a29f6 Remove space in person id query param for tags 2025-01-27 13:14:55 +11:00
Peter Stockings
d2c03cb81b Move person graphs down below title 2025-01-27 13:13:59 +11:00
Peter Stockings
2a5afe51b4 Add All tag to dashboard as well 2025-01-27 02:00:37 +11:00
Peter Stockings
1e625ba7a8 When on overview page add a static tag that selects everything, will have to refactor tags functionality soon 2025-01-27 01:57:36 +11:00
Peter Stockings
6319e488e1 Update page url after visiting page overview 2025-01-27 01:56:42 +11:00
Peter Stockings
2a614ae1c0 Fix view selector all->overview and make overview selected on overview page 2025-01-27 01:26:30 +11:00
Peter Stockings
6b741e50d0 Swtich from person list to new overview page 2025-01-27 01:17:23 +11:00
Peter Stockings
0ed0c20e93 Add person graphs endpoint for workouts per week & PRs per week, consumed via dashboard, person overview and notes 2025-01-27 01:00:50 +11:00
Peter Stockings
049af675cc Remove unused duplicated stats logic for dashboard 2025-01-27 00:18:02 +11:00
Peter Stockings
5ed737ee94 Refactor stats endpoint so supports filtering people and make dashboard page utilise it 2025-01-27 00:07:27 +11:00
Peter Stockings
527395d704 Make stats refresh, and add filter support to stats endpoint 2025-01-26 23:01:39 +11:00
Peter Stockings
23de6ef1f7 Render stats to block in overview 2025-01-26 22:19:34 +11:00
Peter Stockings
17c010ff7f Include total duration in new overview stats 2025-01-26 21:17:02 +11:00
Peter Stockings
d1057aa8ba Add more stats 2025-01-26 21:10:22 +11:00
Peter Stockings
29f7dc1823 Revert "Revert "Add stats to new person overview page, just copied the logic so will need to refactor when the dashboard page is refactored as well""
This reverts commit c569793fd8.
2025-01-26 21:07:19 +11:00
Peter Stockings
c569793fd8 Revert "Add stats to new person overview page, just copied the logic so will need to refactor when the dashboard page is refactored as well"
This reverts commit 4783ce6026.
2025-01-26 20:55:08 +11:00
Peter Stockings
4783ce6026 Add stats to new person overview page, just copied the logic so will need to refactor when the dashboard page is refactored as well 2025-01-26 20:39:20 +11:00
Peter Stockings
dc543c7b75 Show exercise count in stats 2025-01-26 20:31:39 +11:00
Peter Stockings
df3796b30e Dont trigger 'updatedPeople' on person dashboard render anymore 2025-01-26 20:04:15 +11:00