Skip to content

fix(atemschutz): "CSA-Trupp" is a magic string — renaming the Trupp type silently drops the three-person crew rule #398

Closed

Description

@DeepDiver1975

From a portability review of main (ecb341b) asking which implemented logic is Bavarian, which is German, and which is universal. This one is not a portability problem at all — it is a live defect in Bavaria.

The gap

Two Trupp designations carry behaviour, and they carry it by string comparison on their German name:

// src/LageBuch.Domain/Atemschutz/AtemschutzTrupp.cs
public const string ChemicalTruppDesignation = "CSA-Trupp";   // :40
public const string LpaTruppDesignation      = "LPA-Trupp";   // :47

public static bool IsChemicalTrupp(string designation) =>      // :165
    string.Equals(designation?.Trim(), ChemicalTruppDesignation, StringComparison.OrdinalIgnoreCase);

public static int RequiredMemberCount(string designation) =>   // :173
    IsChemicalTrupp(designation) ? ChemicalMemberCount : StandardMemberCount;

RequiredMemberCount decides whether ValidateCrew demands two people or three. IsLpaTrupp picks the 60-minute duration default instead of 30.

Meanwhile the designation comes from md_trupp_types, a free-text list the user edits in the Stammdaten editor. The shipped example is ["Angriffstrupp", "Wassertrupp", "Schlauchtrupp", "CSA-Trupp", "LPA-Trupp"], but nothing pins those spellings.

Why it bites

A brigade that writes CSA Trupp, CSA-Trupp (Chemikalienschutzanzug), Chemietrupp or CSA gets a two-person CSA-Trupp accepted without complaint, and a 30-minute Einsatzzeit instead of 20. There is no warning, no fallback, nothing in the ETB. The rule simply is not there any more, and the crew under the suits is the one who finds out.

OrdinalIgnoreCase plus Trim() covers casing and whitespace and nothing else.

Proposal

Move the behaviour onto the master-data entry instead of parsing its name. md_trupp_types becomes a row rather than a bare string:

TruppType(string Name, int RequiredMembers, int? DefaultDurationMinutes)

AtemschutzTrupp.Register then takes the required crew size and duration as arguments it already half-takes, and IsChemicalTrupp/IsLpaTrupp/RequiredMemberCount disappear along with the two constants.

Touches MasterDataSet.cs, MasterDataStore.cs (md_trupp_types gains columns — note #397 on the reconciliation there), AtemschutzTrupp.cs:40,47,165-198, and the Stammdaten editor. Existing stores migrate by mapping the two known names to (3, 20) and (2, 60) and everything else to (2, null).

Note

The persisted scba_trupps_v17.designation stays free text — this is about where the rule lives, not about constraining what a Trupp may be called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions