Skip to content

Commit

Permalink
throw error when trying to import a CTDLASNCSV without competency text
Browse files Browse the repository at this point in the history
  • Loading branch information
miledivovic committed Nov 27, 2024
1 parent 15297df commit 6f6ed78
Showing 1 changed file with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions src/org/cass/importer/CTDLASNCSVImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = [];
Expand Down

0 comments on commit 6f6ed78

Please sign in to comment.