forked from jappel/leistungsbilanz-ts
Show logical feeder loads in project and circuit views
This commit is contained in:
parent
dfeb0e3cb6
commit
042a050876
12 changed files with 319 additions and 11 deletions
|
|
@ -47,7 +47,10 @@ function makeCircuit(
|
|||
sortOrder,
|
||||
isReserve: deviceRows.length === 0,
|
||||
circuitTotalPower: deviceRows.reduce((total, row) => total + row.rowTotalPower, 0),
|
||||
circuitApparentPower: deviceRows.reduce((total, row) => total + row.rowTotalPower, 0),
|
||||
circuitCosPhi: 1,
|
||||
deviceRows,
|
||||
downstreamBoardLoads: [],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -176,6 +179,44 @@ describe("circuit grid projection", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("renders linked downstream boards as separate read-only rows", () => {
|
||||
const feeder = {
|
||||
...reserveCircuit,
|
||||
isReserve: false,
|
||||
circuitTotalPower: 4,
|
||||
circuitApparentPower: 5,
|
||||
circuitCosPhi: 0.8,
|
||||
downstreamBoardLoads: [{
|
||||
distributionBoardId: "board-child",
|
||||
name: "Unterverteilung",
|
||||
boardNumber: "UV-02",
|
||||
activePowerKw: 4,
|
||||
apparentPowerKva: 5,
|
||||
cosPhi: 0.8,
|
||||
}],
|
||||
};
|
||||
const rows = buildVisibleGridRowsWithStructure(
|
||||
[{ ...sections[0], circuits: [feeder] }],
|
||||
{ headerComponents: [], footerComponents: [] }
|
||||
);
|
||||
assert.deepEqual(rows.map((row) => row.rowType), [
|
||||
"section",
|
||||
"circuitSummary",
|
||||
"downstreamBoardLoad",
|
||||
"placeholder",
|
||||
]);
|
||||
const loadRow = rows[2];
|
||||
assert.equal(
|
||||
loadRow.cells.find((cell) => cell.cellKey === "displayName")?.value,
|
||||
"Unterverteilung UV-02"
|
||||
);
|
||||
assert.equal(
|
||||
loadRow.cells.find((cell) => cell.cellKey === "rowTotalPower")?.value,
|
||||
4
|
||||
);
|
||||
assert.equal(loadRow.cells.every((cell) => !cell.editable), true);
|
||||
});
|
||||
|
||||
it("shows circuit protection once on each visible circuit row", () => {
|
||||
const protectedSections = sections.map((section) => ({
|
||||
...section,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue