From aafef70d321c41ae5cdfd1119449daac615fd980 Mon Sep 17 00:00:00 2001 From: lublagg Date: Wed, 20 Dec 2023 16:01:08 -0500 Subject: [PATCH] Fix duplicate crop columns. --- src/scripts/api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/api.ts b/src/scripts/api.ts index 587aadc..c8f6cef 100644 --- a/src/scripts/api.ts +++ b/src/scripts/api.ts @@ -137,10 +137,9 @@ export const getAllAttrs = (selectedOptions: IStateOptions) => { } } else if (typeof short_desc === "object" && cropUnits) { const attr = short_desc[cropUnits as keyof ICropDataItem][0]; - allAttrs.push({"name": attrToCODAPColumnName[attr].attributeNameInCodapTable}); const codapColumnName = attrToCODAPColumnName[attr].attributeNameInCodapTable; const codapColumnUnit = attrToCODAPColumnName[attr].unitInCodapTable; - allAttrs.push({"name": codapColumnName, "unit": codapColumnUnit}); + allAttrs.push({"name": codapColumnName, "unit": codapColumnUnit}); } } } @@ -209,6 +208,7 @@ export const createTableFromSelections = async (selectedOptions: IStateOptions, return "success"; } else { const attrDefinitions = allAttrs.map((attr) => makeCODAPAttributeDef(attr, geographicLevel)); + console.log("attrDefinitions", attrDefinitions); await createParentCollection(dataSetName, "Data", attrDefinitions); await createItems(dataSetName, items); await createTable(dataSetName, dataSetName);