mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-07-19 08:53:01 +00:00
Users could only create scenarios buried inside the CSV-upload modal, at trigger time. This adds a first-class Scenarios tab: a gallery of the portfolio's scenarios, a read-only detail page, and a 3-step creation journey (goal → measures → review) that saves app-authored scenario rows per ADR-0003. Domain rules (TDD'd in src/lib/scenarios/model.test.ts, 19 tests): - goal semantics: "Increasing EPC" requires a target band; all other goals are maximise-within-budget with goal_value forced null - exclusions-only measure model: normalised (dedupe+sort), unknown keys rejected, all-excluded rejected, empty set valid; serialised to the backend's brace text format (parses the legacy space-padded variant) - insert mapping: multi_plan=true, is_default=false, budget per property - exact-config duplicate detection ignoring name (review-step warning) - status derived from plan existence — no stored status column Queries follow the ADR's discipline: gallery status = one grouped COUNT(DISTINCT property_id) per portfolio; detail = one scoped count (index-only, powers the blocked-delete message); delete = single atomic DELETE guarded on NOT EXISTS(plans). Rename is the only other mutation — configuration is immutable. Verified live on portfolio 814: create (400 on missing band, 201 on CO₂ draft), derived Awaiting/Modelled in the gallery, rename, delete of the draft (200) and blocked delete of the modelled scenario (409, "338 properties…" matching the portfolio's true count). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| adr | ||
| design | ||
| runbooks | ||
| wip | ||