diff --git a/changelog.md b/changelog.md
index f3bdf58..f38dd0f 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,7 @@
## 2025-11-12
+- Persisted initial capex calculations to project and scenario snapshot tables via shared helper in `routes/calculations.py`, centralised Jinja filter registration, and expanded integration tests to assert HTML/JSON flows create snapshots with correct totals and payload metadata (requires full-suite pytest run to satisfy 80% coverage gate).
- Resolved test suite regressions by registering the UI router in test fixtures, restoring `TABLE_DDLS` for enum validation checks, hardening token tamper detection, and reran the full pytest suite to confirm green builds.
- Fixed critical 500 error in reporting dashboard by correcting route reference in reporting.html template - changed 'reports.project_list_page' to 'projects.project_list_page' to resolve NoMatchFound error when accessing /ui/reporting.
- Completed navigation validation by inventorying all sidebar navigation links, identifying missing routes for simulations, reporting, settings, themes, and currencies, created new UI routes in routes/ui.py with proper authentication guards, built corresponding templates (simulations.html, reporting.html, settings.html, theme_settings.html, currencies.html), registered the UI router in main.py, updated sidebar navigation to use route names instead of hardcoded URLs, and enhanced navigation.js to use dynamic URL resolution for proper route handling.
diff --git a/routes/calculations.py b/routes/calculations.py
index 8063a21..b31ea05 100644
--- a/routes/calculations.py
+++ b/routes/calculations.py
@@ -805,7 +805,7 @@ def capex_form(
)
async def capex_submit(
request: Request,
- _: User = Depends(require_authenticated_user),
+ current_user: User = Depends(require_authenticated_user),
uow: UnitOfWork = Depends(get_unit_of_work),
project_id: int | None = Query(
None, description="Optional project identifier"),
@@ -877,6 +877,15 @@ async def capex_submit(
uow=uow, project_id=project_id, scenario_id=scenario_id
)
+ _persist_capex_snapshots(
+ uow=uow,
+ project=project,
+ scenario=scenario,
+ user=current_user,
+ request_model=request_model,
+ result=result,
+ )
+
if wants_json:
return JSONResponse(
status_code=status.HTTP_200_OK,
diff --git a/templates/partials/sidebar_nav.html b/templates/partials/sidebar_nav.html
index 25382bf..e9fa0d8 100644
--- a/templates/partials/sidebar_nav.html
+++ b/templates/partials/sidebar_nav.html
@@ -19,7 +19,7 @@ request.url_for('auth.password_reset_request_form') if request else
"match_prefix": "/"}, {"href": projects_href, "label": "Projects",
"match_prefix": "/projects"}, {"href": project_create_href, "label": "New
Project", "match_prefix": "/projects/create"}, {"href": "/imports/ui", "label":
-"Imports", "match_prefix": "/imports"} ] }, { "label": "Insights", "links": [
+"Imports", "match_prefix": "/imports"}, {"href": request.url_for('calculations.profitability_form') if request else '/calculations/profitability', "label": "Profitability Calculator", "match_prefix": "/calculations/profitability"}, {"href": request.url_for('calculations.capex_form') if request else '/calculations/capex', "label": "Initial Capex Planner", "match_prefix": "/calculations/capex"} ] }, { "label": "Insights", "links": [
{"href": "/ui/simulations", "label": "Simulations"}, {"href": "/ui/reporting",
"label": "Reporting"} ] }, { "label": "Configuration", "links": [ { "href":
"/ui/settings", "label": "Settings", "children": [ {"href": "/theme-settings",
diff --git a/templates/scenarios/capex.html b/templates/scenarios/capex.html
index cb79566..d1e0a9c 100644
--- a/templates/scenarios/capex.html
+++ b/templates/scenarios/capex.html
@@ -10,7 +10,7 @@
{% if scenario %}
{{ scenario.name }}
{% endif %}
- Initial Capex
+ Initial Capex Planner