From 58a7c69e08a3870f623b079f450f7106bbdf3ac7 Mon Sep 17 00:00:00 2001 From: Scott Cytacki Date: Thu, 12 Dec 2024 13:01:31 -0500 Subject: [PATCH] handle "none" attribute types also remove some properties that only occurred in a single file --- v3/src/components/graph/v2-graph-importer.ts | 9 +++------ v3/src/v2/codap-v2-types.ts | 11 ++++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/v3/src/components/graph/v2-graph-importer.ts b/v3/src/components/graph/v2-graph-importer.ts index e1eca2679..bc128f114 100644 --- a/v3/src/components/graph/v2-graph-importer.ts +++ b/v3/src/components/graph/v2-graph-importer.ts @@ -88,12 +88,9 @@ export function v2GraphImporter({v2Component, v2Document, sharedModelManager, in attribute = v2Document.getV3Attribute(v2AttrId), v3AttrId = attribute?.id ?? '', v2Role = v2Component.componentStorage[`${attrKey}Role`], - v2Type = v2Component.componentStorage[`${attrKey}AttributeType`], - // TODO_V2_IMPORT If v2Type is 0 then v3Type will be 0 and the if block below will be skipped - // v3TypeFromV2TypeIndex refers to a "type eNone === 0" which in v3 is supposed to be undefined. - // So perhaps we should handle a v2Type of 0, and enter the if block to create the attribute description? - v3Type = v2Type && v3TypeFromV2TypeIndex[v2Type] - if (v3AttrRole && v3AttrId && v3Type) { + v2Type = v2Component.componentStorage[`${attrKey}AttributeType`] + if (v2Type != null && v3AttrRole && v3AttrId) { + const v3Type = v3TypeFromV2TypeIndex[v2Type] const v2PrimaryNumeric = 1 const v2PrimaryCategorical = 3 if (["x", "y"].includes(attrKey) && (v2Role === v2PrimaryNumeric || v2Role === v2PrimaryCategorical)) { diff --git a/v3/src/v2/codap-v2-types.ts b/v3/src/v2/codap-v2-types.ts index d02a9ccad..0088c5b8d 100644 --- a/v3/src/v2/codap-v2-types.ts +++ b/v3/src/v2/codap-v2-types.ts @@ -853,11 +853,12 @@ export interface ICodapV2BaseComponent { // based on the results for `right`, this must be optional y?: number - // these *Orig properties only occur in a single file in cfm-shared - leftOrig?: number - topOrig?: number - widthOrig?: number - heightOrig?: number + // These *Orig properties only occur in a single file in cfm-shared + // They are retained here incase we review the files in cfm-shared again + // leftOrig?: number + // topOrig?: number + // widthOrig?: number + // heightOrig?: number } savedHeight?: number | null }