Refactor transport calculation into shared domain

This commit is contained in:
2026-09-24 13:11:18 +02:00
parent fa3000b325
commit defbf20202
10 changed files with 582 additions and 132 deletions
+7 -5
View File
@@ -56,6 +56,7 @@ The app uses HTTP Basic Auth. Current users are defined in `BETA_USERS` in `app.
├── ollama_nlu.py
├── pdf_report.py
├── roll_calculation.py
├── transport_calculation.py
├── rollcalc_chat.py
├── integrations/
│ └── openwebui/
@@ -105,6 +106,7 @@ Implemented routes:
| `/api/user` | `GET` | Basic Auth | Returns current authenticated user info. |
| `/api/calculations/roll` | `POST` | Basic Auth | Resolves, validates, and executes a direct roll-diameter request. |
| `/api/calculations/roll/modify` | `POST` | Basic Auth | Applies explicit changes to structured calculation state and recalculates. |
| `/api/calculations/transport` | `POST` | Basic Auth | Executes the shared transport-capacity analysis. |
| `/api/reports/roll-calculation.pdf` | `POST` | Basic Auth | Recalculates a request authoritatively and returns a one-page PDF. |
| `/api/conversations` | `POST` | Basic Auth | Creates an in-memory conversation session. |
| `/api/conversations/<id>/messages` | `POST` | Basic Auth | Interprets one utterance and executes the deterministic workflow. |
@@ -409,12 +411,12 @@ There is also a richer `static/config.json` with localized messages and more det
### Load Optimizer
The Load Optimizer is implemented by inline classes in `templates/roll_calculator.html`:
`transport_calculation.py` is the authoritative capacity calculation. It owns
the active transport presets and `analyze_transport()`. The browser collects
inputs, calls `POST /api/calculations/transport`, renders the returned analysis,
and draws the SVG front view; it does not calculate capacity itself.
- `LoadOptimizer`
- `LoadOptimizerUI`
It uses calculated roll data from the Direct Calculation tab and estimates loading capacity for transport presets or custom dimensions.
It uses the displayed roll data from the Direct Calculation tab and estimates loading capacity for transport presets or custom dimensions. In particular, the direct tab writes the roll weight with one decimal place before the optimizer consumes it; this behavior is intentionally preserved.
Preset transport units include: