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.
```
This commit is contained in:
Peter Stockings
2025-03-30 22:20:48 +11:00
parent 4a822ea2ba
commit 6095e76f10
12 changed files with 244 additions and 175 deletions

2
db.py
View File

@@ -6,7 +6,6 @@ from dateutil.relativedelta import relativedelta
from urllib.parse import urlparse
from flask import g
import pandas as pd
from features.calendar import Calendar
from features.exercises import Exercises
from features.people_graphs import PeopleGraphs
from features.person_overview import PersonOverview
@@ -19,7 +18,6 @@ from utils import get_exercise_graph_model
class DataBase():
def __init__(self, app=None):
self.calendar = Calendar(self.execute)
self.stats = Stats(self.execute)
self.workout = Workout(self.execute)
self.exercises = Exercises(self.execute)