forked from jappel/leistungsbilanz-ts
Complete Revit object editor assignments
This commit is contained in:
parent
4489cd76f0
commit
77d775fde1
25 changed files with 853 additions and 77 deletions
|
|
@ -14,6 +14,7 @@ import {
|
|||
circuitSectionRepository,
|
||||
distributionBoardComponentRepository,
|
||||
distributionBoardRepository,
|
||||
externalModelStateRepository,
|
||||
projectRepository,
|
||||
} from "../composition/application-repositories.js";
|
||||
|
||||
|
|
@ -88,6 +89,13 @@ export async function buildProjectCircuitTrees(
|
|||
circuitListRepository.listByProject(projectId),
|
||||
distributionBoardRepository.listByProject(projectId),
|
||||
]);
|
||||
const externalState = externalModelStateRepository.getByProject(projectId).state;
|
||||
const externalCountByRowId = new Map<string, number>();
|
||||
for (const object of externalState.objects) {
|
||||
if (object.circuitDeviceRowId) {
|
||||
externalCountByRowId.set(object.circuitDeviceRowId, (externalCountByRowId.get(object.circuitDeviceRowId) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
const listIds = lists.map((entry) => entry.id);
|
||||
const [sections, circuits, components] = await Promise.all([
|
||||
circuitSectionRepository.listByCircuitLists(listIds),
|
||||
|
|
@ -237,6 +245,7 @@ export async function buildProjectCircuitTrees(
|
|||
row.powerPerUnit,
|
||||
row.simultaneityFactor
|
||||
),
|
||||
externalObjectCount: externalCountByRowId.get(row.id) ?? 0,
|
||||
}));
|
||||
const circuitLoad = loads.circuits.get(circuit.id);
|
||||
if (!circuitLoad) throw new Error("Circuit load is missing.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue