Skip to content

feat(comessung): per-floor unit counts and labels (Option B) - #268

Merged
DeepDiver1975 merged 2 commits into
mainfrom
feat/co-messung-per-floor-units
Sep 8, 2026
Merged

DeepDiver1975 merged 2 commits into
mainfrom
feat/co-messung-per-floor-units

Conversation

@DeepDiver1975

@DeepDiver1975 DeepDiver1975 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Relates to #265: CO-Messung floors (EG/OG/UG) currently share one apartment count and one set of column labels across the whole building, which doesn't match real buildings where each floor's unit layout can differ.

This PR now carries both halves of #265:

It supersedes #267 ("Option A", a free-form unit list for UG floors only). Option A keeps one shared count for every floor ≥ 0, so it cannot express the test building below, where five above-ground floors need five different counts.

Changes

Data model (Option B)

  • Building.ApartmentCounts holds per-floor overrides of ApartmentsPerFloor; ApartmentLabels is now keyed by floor+apartment instead of apartment number alone, so a custom label on one floor can't leak onto a same-numbered unit on another floor.
  • Incident.SetApartmentCount grows/trims a single floor's dwellings without touching any other floor.
  • The shared apartment-column header row is gone; each tile shows its own editable-via-sidebar Bezeichnung.
  • CoMessprotokollSection (PDF) lists each floor's units individually instead of a fixed-column table, since column counts now vary per floor.
  • SQLite gains an apartment_counts column (V20); a pre-CO-Messung: UG usually have different layouts than OG/EG #265 apartment_labels payload (keyed by apartment number alone) is migrated to apply across every floor that existed when it was saved, so existing custom labels survive the upgrade.

Layout (#270)

  • Floor bands: tiles wrap inside their floor instead of extending its row, so the layout no longer depends on unit count.
  • Every floor fills the line via a new EqualWidthWrapPanel, so the two Penthäuser are together as wide as the four Wohnungen below them and the matrix reads as a cross-section of the building. It wraps rather than shrinking a column below 96px, because squeezing a 14-unit floor into a narrow window trims the ppm reading away.
  • Compact tiles carrying identity, status, ppm and residents; an unmeasured unit renders empty rather than Kein Messwert.
  • Building summary (29 Einheiten · 7 durchsucht · 1 betroffen · 21 offen) with a segmented bar, plus per-floor progress beside each floor's Nutzung.
  • Status filter ALLE / OFFEN / BETROFFEN, and a STRUKTUR mode holding the per-floor count spinners and UG/OG HINZUFÜGEN.

Screenshots

The building #265 is really about: 1.UG 14 Kellerabteile, EG 3 Läden, 1.OG 2 Praxen, 2./3.OG 4 Wohnungen each, 4.OG 2 Penthäuser — 29 units, six floors, five different counts. Same incident state in both shots.

Before, on main — the building can't be entered at all. One shared count forces all six floors to 4 units (20 where reality has 29), and naming the EG's shops renames column 1/2/3 on every floor, so the penthouse floor and the basement are also labelled Bäckerei / Kiosk / Supermarkt:

Before: one shared count and shared column labels across every floor

After — each floor owns its count and its labels, every floor fills the line, and all 14 Kellerabteile are visible without horizontal scrolling:

After: per-floor counts and labels, floor bands, summary and status filter

At 1280 the 14-unit floor wraps instead of shrinking, so every ppm value stays legible:

At 1280 the basement wraps to 9 + 5

STRUKTUR mode, holding the per-floor Wohnungen counts and the floor buttons:

STRUKTUR mode with GESCHOSSE buttons and per-floor counts

Checklist

  • Commits follow Conventional Commits and are DCO signed off (git commit -s)
  • dotnet build and dotnet test pass locally (999 tests)
  • UI changes include before/after screenshots
  • No real master data / personnel data committed (screenshots use fictional data)

🤖 Generated with Claude Code

https://claude.ai/code/session_01PXhXSh2pae9WnaACYUUe3V

EG/OG and UG floors rarely share one Wohnungen-per-floor count or one
set of column labels in reality (#265). Rather than bolting a
special case onto UG floors, make every floor own its count and its
units' labels independently, and drop the shared header row that
made "column 3" look like a stable identity when it was really just
an array index shared across every floor of the building:

- Building.ApartmentCounts holds per-floor overrides of
  ApartmentsPerFloor (the seed for a newly added floor); ApartmentLabels
  is now keyed by floor+apartment instead of apartment number alone,
  so a custom label on one floor can never leak onto a same-numbered
  unit on another floor.
- Incident.SetApartmentCount grows/trims a single floor's Dwellings
  without touching any other floor.
- The shared apartment-column header is gone; each tile shows its own
  editable-via-sidebar Bezeichnung, and each floor row gets its own
  Wohnungen-count control.
- CoMessprotokollSection (PDF) lists each floor's units individually
  instead of a fixed-column table, since column counts now vary
  per floor.
- SQLite gains an apartment_counts column (V20); a pre-#265
  apartment_labels payload (keyed by apartment number alone) is
  migrated to apply across every floor that existed when it was
  saved, so existing custom labels survive the upgrade.

This lands as a separate, from-scratch alternative to the free-form
UG unit list from the other PR -- not stacked on top of it -- since
the two are different answers to the same problem and either one on
its own already changes UG floors' shape.

Co-authored-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
…lter (#270)

* feat(co-messung): floor bands, compact tiles and a building summary

A real mixed-use building has a different unit count on nearly every floor
(#265): 14 Kellerabteile, 3 Läden, 2 Praxen, 4+4 Wohnungen, 2 Penthäuser.
Per-floor counts let that be entered, but the layout still gave each floor one
row of 148px tiles, so horizontal demand was set by the widest floor: 14 units
needed 2130px and clipped at unit 10, while the 2-unit floors reserved that
same width and wasted it. Restructure the view around what a crew actually
reads:

- Floor bands: tiles wrap inside their floor instead of extending its row, so
  the layout no longer depends on the unit count at all. All 29 units of the
  building above fit one screen at 1920 with no horizontal scroll, and wrap
  cleanly at 1400.
- Compact tiles (104x46, was 148x90) carrying identity, status and ppm only.
  CoCompact renders an unmeasured unit as empty rather than "Kein Messwert" --
  that string was the resting state of every tile in a fresh building and
  buried the values that did exist. Resident, key and full status wording move
  to a tooltip and the editor. 46px keeps the tap target above the 44px floor.
- A building summary strip (29 Einheiten · 7 durchsucht · 1 betroffen ·
  21 offen) with a segmented progress bar, plus per-floor "9/14" progress in
  the band gutter next to the floor's Nutzung.
- A status filter (ALLE / OFFEN / BETROFFEN) that drops finished floors
  entirely, since "what's left" is the question under pressure. Band and
  summary counts keep describing whole floors while filtered.
- The per-floor count spinners move behind a STRUKTUR toggle: describing the
  building is a setup job, and leaving those controls in the grid put an edit
  control between the crew and every tile for the rest of the incident.
  Entering structure mode clears an active filter.

The active filter chip deliberately avoids Button.signal: that red is
"Person(en) betroffen" on every tile, and must not also mean "this list is
filtered".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXhXSh2pae9WnaACYUUe3V
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

* feat(co-messung): fill each floor's line, move floor buttons into STRUKTUR

Two refinements to the floor-band layout:

Every floor now spans the full width, so the two Penthäuser on 4.OG are
together as wide as the four Wohnungen below them and the matrix reads as a
cross-section of the building rather than a ragged left-aligned list. Fixed
104px tiles left a 2-unit floor ending at 213px against the 14-unit
basement's full line.

Neither WrapPanel (keeps each child at its own width) nor UniformGrid (fills
the line, but with no lower bound) does this, so add EqualWidthWrapPanel: it
divides the line into equal columns and wraps rather than shrinking a column
below MinItemWidth. That floor matters -- squeezing a 14-unit floor into a
narrow window trims the ppm reading away, and on a CO protocol that is the
one number that must not disappear. At 1920 every floor is one full-width
line; at 1280 the basement wraps to 9 + 5 and stays legible.

UG/OG HINZUFÜGEN move out of the bottom dock into the STRUKTUR toolbar.
Adding a floor is structure editing, the same job as the per-floor Wohnungen
counts that already live behind that toggle -- the dock keeps the
building-level controls (HAUS auswählen/entfernen/hinzufügen).

Tests: a width theory over 1280/1400/1920 asserting no tile falls below
MinItemWidth and no floor overflows its band, plus the 4.OG/3.OG rows ending
on the same edge. They measure the tile Borders, not the panel's item
containers -- measuring containers passed while the columns stretched and the
tiles inside them sat narrow at the left, which is exactly the bug the
missing HorizontalAlignment on the tile Button caused.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXhXSh2pae9WnaACYUUe3V
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

* fix(co-messung): show a unit's residents on its tile again

Compacting the tile to 104x46 (e9ecab7) dropped the ResidentName row and left
the name reachable only through the tile's tooltip. That reads as "moved to
progressive disclosure" but is really "not displayed": the crew scans the
whole matrix at a glance to see who is behind which door, and a value that
needs hovering one tile at a time is not available for that job at all.

Put the row back and grow the tile 46 -> 62px to carry it. The optional
free-text note stays what the sidebar calls it, NAME DER BEWOHNER: identity
is the unit's Bezeichnung, this is who lives there.

The mixed-use scenario now sets residents on two units (fictional names, per
CONTRIBUTING) so the test asserts against something rendered rather than an
empty binding -- it failed before this change and passes after.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXhXSh2pae9WnaACYUUe3V
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

* fix(co-messung): keep the tiles clear of the vertical scrollbar

Two separate causes, both only visible once the tiles started filling the
line edge to edge (8c1a5c0); before that the rightmost ~16px were slack.

1. Avalonia's ScrollViewer defaults to AllowAutoHide=True, which floats the
   scrollbar over the content instead of reserving layout space: measured
   viewport width stayed equal to the ScrollViewer's own width (1676), the
   16px bar sat at x=1660, and the tiles ran to 1677. AllowAutoHide="False"
   on the matrix ScrollViewer reserves the lane.

2. That left exactly 1px. EqualWidthWrapPanel arranged children at
   column * (itemWidth + spacing) with a fractional itemWidth -- 1556px over
   4 columns is 385.25 -- and Avalonia's layout rounding then rounded each
   position and each width independently, pushing the last column a pixel
   past the panel. It showed only on floors whose fraction rounded up: the
   4-, 3- and 14-unit rows overflowed, the 2-unit rows didn't. Derive both
   column edges from one rounded grid instead, so the columns tile the width
   exactly and the leftover pixel is absorbed as a 1px difference between
   columns.

Regression test forces the scrollbar with a short window and asserts no tile
extends past the bar's left edge.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXhXSh2pae9WnaACYUUe3V
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

---------

Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@DeepDiver1975
DeepDiver1975 merged commit ae34f8e into main Sep 8, 2026
2 checks passed
@DeepDiver1975
DeepDiver1975 deleted the feat/co-messung-per-floor-units branch September 8, 2026 20:16
DeepDiver1975 added a commit that referenced this pull request Sep 9, 2026
… values (#278)

* feat(co-messung): color-code ppm danger severity, warn on implausible values

Two of the four CO-Messprotokoll findings in the UX-review issue (#262) are
still open against current main: ppm readings carry no visual danger signal
(a lethal 800+ ppm reading looks identical to a trace 5 ppm one), and there
is no plausibility check on ppm entry (a 9999 vs 999 typo goes undetected).
The other two findings from that issue (entry-flow friction, grid scrolling)
were already resolved by unrelated prior work (#242, #265, #268).

Adds a CoSeverityClassifier (Normal/Elevated/Dangerous/Lethal, AGW-anchored
at 30ppm up to a 800ppm lethal band) driving Classes.elevated/dangerous/lethal
on the tile's ppm text and a matching ppm span color in the PDF export,
mirroring ScbaView's alarm-coloring pattern. Adds a non-blocking caution
below the CO-WERT field above 2000ppm (a likely typo, not rejected -- a real
fire scene can genuinely produce extreme readings). Also lets Enter in the
CO-WERT field commit like FERTIG, without touching the #242 buffer/commit
model.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R9oidCyJ6YmhtCxu9WxGKo
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

* test(co-messung): cover the implausible-value warning end-to-end

Adds acceptance coverage that drives the real CO-WERT NumericUpDown
(keyboard input, not just setting Editor.CoValue directly) to confirm the
implausible-value warning shows live while typing, and that the #278
Enter-to-commit KeyBinding actually persists the value through the real
control -- closing the gap the existing VM-level tests couldn't: whether
the XAML binding, IsVisible, and the Enter routing genuinely work end to
end, not just the view-model logic in isolation.

Names the CO-WERT NumericUpDown (x:Name="CoValueInput") so tests can find
it directly, matching the existing convention (e.g. AddBuildingButton,
DwellingEditor).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R9oidCyJ6YmhtCxu9WxGKo
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

* fix(co-messung): drop Enter-to-commit, it hid the implausible-value warning

Reported after the first version of this PR: typing a high ppm value and
pressing Enter (a single fluid motion) closed the WOHNUNG-BEARBEITEN
sidebar in the same instant the "Ungewöhnlich hoher Wert" warning
appeared, so it was never actually visible.

Root cause, confirmed against Avalonia 12.1.2's NumericUpDown source:
Value already live-updates from Text on every keystroke (TextBox.TextChanged
-> NumericUpDown.Text -> SyncTextAndValueProperties), which is genuinely
what drives the warning while typing -- that part worked correctly. The
bug was the KeyBinding added on top of it: NumericUpDown's own OnKeyDown
already commits+consumes Enter for its numeric text, and layering
ConfirmEditorCommand on the same key closed the whole editor the moment
Enter was pressed, before a human typing-then-Enter could ever read the
warning that had just appeared.

Removes the KeyBinding entirely rather than trying to sequence it more
carefully: it was always the smaller, optional half of the original
change (an entry-flow convenience), and it directly undercut the more
important plausibility warning. Only FERTIG/ABBRECHEN close the editor
now, same as before this PR. Replaces the two Enter-commits tests with a
regression pin (Enter must NOT close the editor) plus a FERTIG-commits
test that exercises the same commit path via the command directly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R9oidCyJ6YmhtCxu9WxGKo
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

* fix(co-messung): stop CO-WERT silently ignoring out-of-range typos

Reported: typing "111111111" into CO-WERT did nothing at all -- no color,
no warning, no visible reaction.

Traced against Avalonia 12.1.2's NumericUpDown source:
ClipValueToMinMax defaults to false. When typed text parses to a value
above Maximum, the control's own ConvertTextToValue throws
ArgumentOutOfRangeException; SyncTextAndValueProperties swallows it
(parsedTextIsValid = false, spinner disabled) and never calls
SetValueInternal, so the bound Value -- and therefore Editor.CoValue --
never updates. Exactly the fat-finger typo the plausibility warning was
built to catch, met with total silence instead.

ClipValueToMinMax="True" makes the same input clip to Maximum (9999)
instead of being discarded, which lands comfortably inside both the
Lethal and implausible-value bands, so a wild typo now gets a real,
visible reaction rather than none.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R9oidCyJ6YmhtCxu9WxGKo
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>

---------

Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@DeepDiver1975 DeepDiver1975 mentioned this pull request Sep 9, 2026
34 of 53 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant