forked from jappel/leistungsbilanz-ts
Add explicit "no protection device" state for circuits
Circuits can now record that they deliberately have no protection device (type NONE, shown as "–"), separate from circuits whose protection is still open. Migration 0017 makes rated_current_a nullable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1f3b903809
commit
38019fe087
27 changed files with 3673 additions and 132 deletions
|
|
@ -3,14 +3,26 @@ import type {
|
|||
} from "../../domain/models/circuit-protection-project-command.model";
|
||||
import { createDefaultCircuitProtection } from "../../domain/services/protection-device-defaults";
|
||||
import type { CircuitGroupCategory } from "../../shared/constants/circuit-group";
|
||||
import { noCircuitProtectionDeviceType } from "../../shared/constants/protection-device";
|
||||
import type {
|
||||
CircuitTreeProtectionDeviceDto,
|
||||
CircuitTreeCircuitProtectionDeviceDto,
|
||||
} from "../types";
|
||||
|
||||
export function toCircuitProtectionSnapshot(
|
||||
circuitId: string,
|
||||
protection: CircuitTreeProtectionDeviceDto
|
||||
protection: CircuitTreeCircuitProtectionDeviceDto
|
||||
): CircuitProtectionSnapshot {
|
||||
if (protection.type === noCircuitProtectionDeviceType) {
|
||||
return {
|
||||
circuitId,
|
||||
type: noCircuitProtectionDeviceType,
|
||||
ratedCurrentA: null,
|
||||
fuseUtilizationCategory: null,
|
||||
tripCharacteristic: null,
|
||||
rcdType: null,
|
||||
ratedResidualCurrentMa: null,
|
||||
};
|
||||
}
|
||||
return {
|
||||
circuitId,
|
||||
type: protection.type,
|
||||
|
|
@ -26,8 +38,8 @@ export function toCircuitProtectionSnapshot(
|
|||
|
||||
export function getCircuitProtectionEditorInitialValue(
|
||||
category: CircuitGroupCategory | undefined,
|
||||
protection: CircuitTreeProtectionDeviceDto | undefined
|
||||
): CircuitTreeProtectionDeviceDto {
|
||||
protection: CircuitTreeCircuitProtectionDeviceDto | undefined
|
||||
): CircuitTreeCircuitProtectionDeviceDto {
|
||||
if (protection) {
|
||||
return protection;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue