Integrate rough estimate balance

This commit is contained in:
Julian Appel 2026-09-27 12:37:59 +02:00
commit 573487666c
45 changed files with 9378 additions and 58 deletions

View file

@ -615,6 +615,30 @@ Future sizing will need:
Users must be able to override sizing suggestions.
## Estimate Balance Module (Grobe Leistungsbilanz)
`src/estimate-balance` plus `src/shared/estimate-balance` is a separate module
for the early-phase power balance by DIN 276 cost group (see
`docs/estimate-balance.md`). Rules:
- It has its own tables (`estimate_*`) and never writes circuit, board or
project-device data; it only reads device rows for the comparison.
- Writes use the project command mechanism (`estimate-balance.insert/.update/
.delete` with complete documents), so revision checks and Undo/Redo apply.
- The calculation and comparison live in the import-free
`src/shared/estimate-balance/estimate-balance.ts` and are shared by API and UI;
displayed values use `roundEstimateValue`.
- It is deliberately not part of named/automatic project snapshots or snapshot
restore; those operations leave estimate balances unchanged. Portable project
transfer format version 2 includes every estimate balance and remaps balance,
group and row ids when duplicating a project. Version 1 transfers remain
importable and contain no estimate balances.
- UI: `/projects/:id/grobbilanz` (Stände) and `/grobbilanz/:balanceId` (editor,
`src/frontend/estimate-balance/`). The editor autosaves the whole document
debounced (one Undo step per save), keeps invalid raw input local, and on a
409 reloads only if the balance itself changed; otherwise it re-saves with
the new revision. `request()` throws `ApiRequestError` (status, code).
## Persistence and Migration Rules
- SQLite is the currently supported database.