diff --git a/src/org/cass/importer/CTDLASNCSVImport.js b/src/org/cass/importer/CTDLASNCSVImport.js index 6785ede7..a15c69e7 100644 --- a/src/org/cass/importer/CTDLASNCSVImport.js +++ b/src/org/cass/importer/CTDLASNCSVImport.js @@ -64,32 +64,37 @@ module.exports = class CTDLASNCSVImport { } duplicates.sort((a, b) => a.competencyText < b.competencyText ? -1 : 1); } - } - for (let i = 0; i < tabularData.length; i++) { - if (i == 0) continue; - let col = tabularData[i]; - if ( - col[typeCol] != null && - col[typeCol].trim() == "ceasn:CompetencyFramework" - ) - frameworkCounter++; - else if ( + for (let i = 0; i < tabularData.length; i++) { + if (i == 0) continue; + let col = tabularData[i]; + if ( col[typeCol] != null && - col[typeCol].trim() == "ceterms:Collection" + col[typeCol].trim() == "ceasn:CompetencyFramework" ) - collectionCounter++; - else if ( - col[typeCol] != null && - col[typeCol].trim() == "ceasn:Competency" - ) - competencyCounter++; - else if (col[typeCol] == null || col[typeCol] == "" || col[typeCol].toLowerCase().startsWith('sample') || col[typeCol].toLowerCase().startsWith('instruction')) - continue; - else { - this.error("Found unknown type:" + col[typeCol]); - return; + frameworkCounter++; + else if ( + col[typeCol] != null && + col[typeCol].trim() == "ceterms:Collection" + ) + collectionCounter++; + else if ( + col[typeCol] != null && + col[typeCol].trim() == "ceasn:Competency" + ) { + competencyCounter++; + if (colCompetencyText && !col[colCompetencyText].trim()) { + this.error('CTDLASN Parse Error: Competency text is empty on line ' + (i+1)); + return; + } + } else if (col[typeCol] == null || col[typeCol] == "" || col[typeCol].toLowerCase().startsWith('sample') || col[typeCol].toLowerCase().startsWith('instruction')) + continue; + else { + this.error("Found unknown type:" + col[typeCol]); + return; + } } } + success(frameworkCounter, competencyCounter, collectionCounter, duplicates); }, error: failure @@ -625,7 +630,7 @@ module.exports = class CTDLASNCSVImport { } catch (e) { console.error('Error trimming data', e); } - + const terms = JSON.parse(JSON.stringify((await EcRemote.getExpectingObject("https://schema.cassproject.org/0.4/jsonld1.1/ceasn2cassTerms")))); let frameworks = {}; let frameworkArray = [];