From 43d0467d367b54e535d72190afdb7c0ad51b4852 Mon Sep 17 00:00:00 2001 From: Daniel Mulholland Date: Wed, 29 Dec 2021 20:27:54 +1300 Subject: [PATCH] Revise earth switch detection logic. Closes #459 --- src/wizards/conductingequipment.ts | 4 +++- src/zeroline/foundation.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wizards/conductingequipment.ts b/src/wizards/conductingequipment.ts index 9cb7291da3..e7aa161f04 100644 --- a/src/wizards/conductingequipment.ts +++ b/src/wizards/conductingequipment.ts @@ -51,7 +51,9 @@ const types: Partial> = { function typeStr(condEq: Element): string { return condEq.getAttribute('type') === 'DIS' && - condEq.querySelector('Terminal')?.getAttribute('cNodeName') === 'grounded' + Array.from(condEq.querySelectorAll('Terminal')) + .map(t => t.getAttribute('cNodeName')) + .includes('grounded') ? 'ERS' : condEq.getAttribute('type') ?? ''; } diff --git a/src/zeroline/foundation.ts b/src/zeroline/foundation.ts index 87256ec158..38d0fb5496 100644 --- a/src/zeroline/foundation.ts +++ b/src/zeroline/foundation.ts @@ -226,7 +226,9 @@ export function getIcon(condEq: Element): TemplateResult { function typeStr(condEq: Element): string { if ( condEq.getAttribute('type') === 'DIS' && - condEq.querySelector('Terminal')?.getAttribute('cNodeName') === 'grounded' + Array.from(condEq.querySelectorAll('Terminal')) + .map(t => t.getAttribute('cNodeName')) + .includes('grounded') ) { return 'ERS'; } else {