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.
This commit is contained in:
Peter Stockings
2025-03-31 22:08:47 +11:00
parent 6095e76f10
commit 78436b230b
6 changed files with 132 additions and 87 deletions

View File

@@ -154,7 +154,7 @@ def _process_workouts_for_year_view(grouped_workouts, year_date):
months_data.append({
'name': first_day_of_month.strftime('%B'),
'first_day_of_month': first_day_of_month.strftime('%Y-%m-%d'), # Pass date string for URL
'first_day_of_month': first_day_of_month, # Pass the actual date object
'days': month_days_data
})
return months_data
@@ -175,7 +175,7 @@ def get_calendar(person_id):
if selected_view == 'overview':
return redirect(url_for('person_overview', person_id=person_id))
if selected_view == 'notes':
return redirect(url_for('get_person_notes', person_id=person_id))
return redirect(url_for('notes.get_person_notes', person_id=person_id))
try:
start_date, end_date, prev_date, next_date = _get_date_range_and_links(selected_date, selected_view)