Skip to content

Commit

Permalink
bugfix: simplify the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-solovei-s1 committed Nov 18, 2024
1 parent 1ea9832 commit a0f6ddd
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/plugins/src/menu/VirtualTemplateIED.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,16 @@ function getLDeviceDescriptions(
)!;
const lnType = lLN0?.split(": ")[1];

// Map to ensure unique prefixes based on node attributes
const anyLNs = [
{ prefix: null, lnClass: "LLN0", inst: "", lnType },
...selectedLNodes.map((lNode, index) => {
const lnClass = lNode.getAttribute("lnClass")!;
const inst = lNode.getAttribute("lnInst")!;
const lnType = lNode.getAttribute("lnType")!;
const existingPrefix = lNode.getAttribute("prefix") || "";

// Generate unique prefix if not already provided
const uniquePrefix = existingPrefix || `${lnClass}-${index + 1}`; // Prefix includes class and unique index
const prefix = lNode.getAttribute("prefix") || "";

return {
prefix: uniquePrefix,
prefix: prefix || `CSWI-${index}`,
lnClass,
inst,
lnType,
Expand Down

0 comments on commit a0f6ddd

Please sign in to comment.